즐거운프로그래밍

[자바] Vector 클래스 예제

수수께끼 고양이 2023. 10. 23. 09:36
728x90
반응형

 

import java.util.Vector;

class MyInt {
    private int value;
    MyInt(int i) {
        this.value = i;
    }
    int getValue() {
        return value;
    }
}
public class Main {
    public static void main(String[] args) {
        Vector<MyInt> iv=new Vector<MyInt>();
        for(int i=0; i<1000000; i++) {
            iv.add(new MyInt(i));
        }
        for(int i=0; i<iv.size(); i++) {
            MyInt mi = iv.get(i);
            if(i%1000==0)
                System.out.println(mi.getValue());
        }
        // System.out.println(100000000/60/60/24/365);
    }
}

 

...

...

...

 

728x90
반응형