JAVA Basic 강의자료] stop을 이용한 쓰레드 종료 예제
JAVA Basic 강의자료] stop을 이용한 쓰레드 종료 예제
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.
stop을 이용한 쓰레드 종료 예제
<소스코드>
class ThreadEnd extends Thread {
public void run() {
while(true) {
try {
sleep(500);
} catch( InterruptedException e ) { }
System.out.println( getName() );
}
}
public static void main(String[] args) {
ThreadEnd thr = new ThreadEnd();
thr.start();
try {
sleep(2000);
} catch( InterruptedException e ) { }
thr.stop();
}
}
'자바 > Java공부하기' 카테고리의 다른 글
JAVA Basic 강의자료] 멀티 스레드 (0) | 2016.09.08 |
---|---|
JAVA Basic 강의자료] Interrupt을 이용한 쓰레드 종료 예제 (0) | 2016.09.07 |
JAVA Basic 강의자료] Dead (0) | 2016.09.07 |
JAVA Basic 강의자료] NotRunnable (0) | 2016.09.07 |
JAVA Basic 강의자료] Runnable 구현 (0) | 2016.09.07 |