首页 > 编程语言 >java Vector

java Vector

时间:2023-02-25 16:00:10浏览次数:42  
标签:java System Vector 111 println addElement out

public static void main(String[] args){
        Vector v = new Vector();
        // 增
        v.addElement(111);
        v.addElement(222);
        v.addElement(333);
        v.addElement("aaa");
        v.addElement("bbb");
        v.addElement("ccc");
        
        v.add(0, "zero");
        System.out.println(v);

        // 删
        v.remove(Integer.valueOf(111));
        System.out.println(v);
        v.remove(1);
        System.out.println(v);

        // 改
        v.set(0, "零");
        System.out.println(v);

        // 查
        System.out.println(v.get(0));

        // 遍历
        for(int i = 0; i < v.size(); i++){
            System.out.println(v.get(i));
        }
        System.out.println("------------");
        for(Object o : v){
            System.out.println(o);
        }
        
    }

 

标签:java,System,Vector,111,println,addElement,out
From: https://www.cnblogs.com/wgqy/p/17154602.html

相关文章