day06_FlowEx22

육희영·2021년 9월 13일
0

tmp에 배열을 복사해서 출력하기

package day06;

public class FlowEx22 {

	public static void main(String[] args) {
		int[] arr = { 10, 20, 30, 40, 50 };
		int sum = 0;

		for (int i = 0; i < arr.length; i++) {
			System.out.printf("%d", arr[i]);
		}
		System.out.println();
		for (int tmp : arr) { // 향상된 for문
			System.out.printf("%d", tmp);
		}
		System.out.println();
	} // main End

} // class End

출력결과

1020304050
1020304050

0개의 댓글

Powered by GraphCDN, the GraphQL CDN