package ThreadExample;
import java.lang.Thread;

class MyThread extends Thread {
    @Override
    public void run() {
        // 스레드가 수행할 작업 정의
        for (int i = 0; i < 10; i++) {
            System.out.print(i + " ");
            try {
                Thread.sleep(500); // 500ms 대기
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

public class ThreadExample {
    public static void main(String[] args) {
        MyThread thread1 = new MyThread();
        thread1.start();
    }
}
