[230309]

겨울조아·2023년 3월 9일
0
post-thumbnail

메서드 분리 참고 링크

public class Loopy {
	
	static void startSentence() {
		System.out.println("Before the Loop");
	}
	
	static void finishSentence() {
		System.out.println("This is after the loop");
	}

	static void executeLoop(int x) {
		while(x < 4) {
			System.out.println("In the Loop");
			System.out.println("Value of x is " + x);
			x = x + 1;
		}
	}

	public static void main(String[] args) {
		
		startSentence();
		executeLoop(1);
		finishSentence();
		
		
	}

}

0개의 댓글