我收到此错误,但不知道如何解决。我已经阅读了该帖子,但仍然感到困惑。我试图运行 Xlint File.java 但它不工作。运行此代码时,我收到类似的味精
“VectorTest.java 使用未经检查或不安全的操作
重新编译 -Xlint:unchecked for details"
import java.util.Vector;
import java.util.Enumeration;
public class VectorTest
{
public static void main(String args[])
{
Vector v=new Vector(3,4);
System.out.println("Initial size"+ v.size());
System.out.println("Initial capacity"+ v.capacity());
v.addElement(new Integer(1));
v.addElement(new Float(2.5));
v.addElement(new Double(3.45));
v.addElement(new Integer(4));
v.addElement(new Integer(5));
System.out.println("Current Capacity"+ v.capacity());
v.addElement(new Integer(6));
v.addElement(new Integer(7));
v.addElement(new Integer(8));
v.addElement(new Integer(9));
v.addElement(new Integer(10));
v.addElement(new Integer(11));
v.addElement(new Integer(12));
System.out.println("Current Capacity"+ v.capacity());
System.out.println("First element"+(Integer) v.firstElement());
System.out.println("Last element"+(Integer)v.lastElement());
Enumeration e;
e= v.elements();
while(e.hasMoreElements())
{
System.out.println("All elements"+ e.nextElement());
}
}
}