【发布时间】:2018-03-21 18:26:00
【问题描述】:
所以我创建了一个 Point 对象的 ArrayList,但是当我使用 ArrayList 的 get() 方法时,它似乎没有返回 Point 对象。为什么会这样?
public class SkylineDC {
public static void openAndReadFile(String path,ArrayList pointsList){
//opening of the file
Scanner inputFile=null;
try{
inputFile=new Scanner(new File(path));
}
catch (Exception e1){
try{
inputFile=new Scanner(new File(path+".txt"));
}
catch (Exception e2){
System.out.println("File not found..");
System.exit(1);
}
}
//reading of the file
short listSize=inputFile.nextShort();
pointsList=new ArrayList<Point>(listSize);
//pointsList.add(new Point(10,10));
//System.out.println("Size of List:"+pointsList.size());
pointsList.get(0).
}
public static void main(String[] args) {
String path=args[0];
ArrayList totalPoints=null;
openAndReadFile(path,totalPoints);
//System.out.println("finish");
}
}
【问题讨论】:
标签: java object arraylist get point