java静态方法返回值问题
public static ArrayList<Coordinate> createTrajectory(String filename) {
File file = new File(filename);
ArrayList<Coordinate> tra = new ArrayList<Coordinate>();
if(file.exists()) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String str;
String[] line;
Coordinate c;
while(in.readLine() != null) {
str = in.readLine();
line = str.split(",");
Double x = Double.parseDouble(line[2]);
Double y = Double.parseDouble(line[3]);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date t = sdf.parse(line[1]);
c = new Coordinate();
c.setX(x);
c.setY(y);
c.setTime(t);
tra.add(c);
}
in.close();
} catch (IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return tra;
}
为什么报错:Cannot make a static reference to the non-static type Coordinate?????????