LoopMain

"Java Stuty"

Posted by Chungman on March 11, 2021
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package Lecture4;

public class LoopMain {

	public static void main(String[] args) {

		
		loop01 : for(int i =1; i <=3; i++) {
			for(int j =1; j<=5; j++) {
				
				if(j==3) {
					break loop01;					// 가장 가까운 반복문 즉, for문! 탈출 출력값:12 x 3줄
				}							
							
				System.out.print(j);
				
			}
			System.out.println();
		}
		
		
		/*
		for(int i =1; i <=3; i++) {
			for(int j =1; j<=5; j++) {
				
				if(j==3) {
					continue;					// 3을 수행하지 않고 바로 j++로 이동, print수행x
				}							
							
				System.out.print(j);
				
			}
			System.out.println();
		}
		*/

	}

}