下面是一段关于集合类的程序代码,编译后出现:注意:ArrayListTest.java 使用了未经检查或不安全的操作。
注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。就是无法编译通过,不知知问题是出在哪?要怎么做才会让它正常编译通过?
import java.util.*;
class ArrayListTest
{
public static void main(String[] args)
{
ArrayList al=new ArrayList();
try
{
al.add(new Point(1,3));
al.add(new Point(5,6));
al.add(new Point(2,4));
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println(al);
}
}class Point
{
int x,y;
Point(int x, int y)
{
this.x=x;
this.y=y;
}
public String toString()
{
return "x="+x+","+"y="+y;
}
}