Vector judge = new Vector();
judge.addElement("abc");Type safety: The method addElement(Object) belongs to the raw type Vector. References to
generic type Vector<E> should be parameterized
judge.addElement("abc");Type safety: The method addElement(Object) belongs to the raw type Vector. References to
generic type Vector<E> should be parameterized
或者用addElements(Object o)
定义类型,如:Vector<String> v = new Vector<String>();
这样的好处是再你add("abc");后想获取这个元素不需要再转化了。
如,v.get(0)将返回的就是一个String对象。方便!