public class HelloWorld {
public static void main(String[] args) {
MyThread mt1 = new MyThread(); // 3.스레드 객체 생성
mt1.start(); // 4.스레드 실행
}
}
class MyThread extends Thread { // 1.Thread 클래스 상속한 클래스 정의
public void run() { // 2.run()메소드 오버라이드 및 스레드 코드 작성
System.out.println(this.getName());
}
}