package CHAP11;

// 로봇 청소기 역할을 수행하는 스레드 클래스
class RobotVacuum extends Thread {
	public void run() {
		System.out.println("로봇 청소기: 청소를 시작합니다!");
		for (int i = 1; i <= 3; i++) {
			System.out.println("로봇 청소기: 방 " + i + " 청소 중...");
			try {
				Thread.sleep(1000); // 1초 대기 (청소 중인 것처럼 연출)
			} catch (InterruptedException e) {
				// 예외 발생 시 아무 처리 없이 넘어감
			}
		}
		System.out.println("로봇 청소기: 청소 완료!");
	}
}

public class C12_01_Thread { // 스레드 실행 예제
	public static void main(String[] args) {
		// RobotVacuum 스레드 객체 생성
		RobotVacuum cleaner = new RobotVacuum();
		
		// start()를 통해 스레드 실행 (run() 자동 호출됨)
		cleaner.start();
	}
}

