public class ArrayTest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		int[] arr2 = {1, 2, 3, 4, 5};
		
		// arr2 에 있는,
		// 모든 데이터를 출력하세요.
		for (int i = 0;i < arr2.length;i++) {
			System.out.println(arr[i]);
		}

	}

}

배열이름.length로 배열의 길이를 구할 수 있다.

배열에 있는 모든 데이터를 출력하고 싶으면 위와 같이 쓸 수 있다.

+ Recent posts