假设我正在使用这样的对象运行:
static class fileHandler {
File fileToHandle;
ArrayList fileDetails;
fileHandler(File fileIn) {
fileToHandle = fileIn;
}
public void fileHandling() {
try {
Scanner reader = new Scanner(fileToHandle);
reader.useDelimiter(",");
while(reader.hasNext()) {
String s = reader.next();
fileDetails.add(s);
}
} catch (FileNotFoundException e) { System.err.println("File Not Found!"); }
}
}
我怎样才能使“fileDetails”能够在我的方法中工作?