JAVA/chapter21_thread

chapter01 : mainThread

GAWON 2023. 5. 30. 18:29
package org.joonzis.ex;

public class Ex01_mainThread {
	public static void main(String[] args) {
		
		for(int i=0; i<10; i++) {
			try {
				// 0.5초간 일시 정지
				Thread.sleep(500);	// 필수로 예외 처리를 해줘야 함
				System.out.println("Main Thread " + (i+1) + "번 째 출력");
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}