0
這是我迄今爲止...如何將java.io.File轉換或轉換爲java.io.List?
List<Point> points = new ArrayList<Point>();
Scanner input = new Scanner(System.in);
System.out.println("Enter the name of your file (fileName.dat):");
String fileName = input.nextLine();
points = (List<Point>)new File(fileName);
我想投或轉換文件列表。 這是我從NetBeans獲得的錯誤消息: 線程「main」中的異常java.lang.ClassCastException:無法將java.io.File強制轉換爲最接近點處的java.util.List .ClosestPoints.main(ClosestPoints.java :185)