I'm trying to add images from a folder to an array list however I'm getting an "unexpected token" at the beginning of the for loop, a "cannot resolve symbol 'length' and "identifier expected" on the incrementing of the control variable.
I'm using Intellij as my IDE
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class Cards {
File path = new File("/images");
List imageCollection = new ArrayList();
File [] files = path.listFiles();
for(int i = 0; i < files.length; i++){
if (files[i].isFile()) {
imageCollection.add(files[i]);
}
}
}