(01/20)Array와 List 차이와 사용법

[ Array ]

Array는 크기를 고정시켜서 사용하고 그렇기 때문에 연산 속도가 빠르다

 

public class Main{
	public static void main(String[] args){
    	int [] myArray = new int[6];
        myArray[1] = 100;
    
    	ArrayList<Integer> myList = new ArrayList<>();
        myList.add(1);
        myList.add(2);
        myList.add(3);
        myList.remove(3);
    }
}

 

 

[ List ]

List는 유동적이기 때문에 연산 속도가 느리다

 

 

 

 

  Comments,     Trackbacks