Result :
현재 수행중인 스레드 는? :main
Sample code :
/*if you wanna know, the current running thread*/
package kame.ch14.ex01;
public class Ch14Ex03 {
/**
* @param args
*/
public static void main(String[] args) {
Thread t = Thread.currentThread();
// currentThread는 정적 메소드. 객체 없이 클래스명으로 호출 가능함.
// 이렇게 얻어진 스레드는 스레드 레퍼런스 변수에 저장해야 함.
System.out.println("현재 수행중인 스레드 는? :"+ t.getName());
}
}
Reference book 이클립스로 배우는 Java 6 Programming/ 임종권, 전병찬/ 가메출판사
댓글 없음:
댓글 쓰기