这个程序应该告诉我它是否可以找到我命名的文件。Eclipse 没有红线,但每次我运行它时都会收到此错误消息,但我不知道为什么。提前感谢您提供的任何帮助。
import java.io.File;
public class StockMarket {
public StockMarket(String[] args) {
ReadFiles r = new ReadFiles();
System.out.println(r.checkIsFile());
}
}
和二等
import java.io.*;
import java.util.StringTokenizer;
public class ReadFiles {
public static void main(String[] args) {
System.out.println("Test");
File file = new File("C:\\stocks\\yahoo.csv");
int row = 0;
String[] [] items;
}
public boolean checkIsFile() {
File file= new File("C:\\stocks\\yahoo.csv");
return file.isFile();
}
}
错误信息:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
checkIsFile cannot be resolved or is not a field
at StockMarket.main(StockMarket.java:6)