Java 創立線程。本站提示廣大學習愛好者:(Java 創立線程)文章只能為提供參考,不一定能成為您想要的結果。以下是Java 創立線程正文
public class MyThread extends Thread {
public void run() {
System.out.println("MyThread......");
}
public static void main(String[] args) {
MyThread myThread = new MyThread();
myThread.start();
}
}
public class MyRunnable implements Runnable {
public void run() {
System.out.println("MyRunnable......");
}
public static void main(String[] args) {
Thread thread = new Thread(new MyRunnable());
thread.start();
}
}