线程简单实例
线程简单实例
public class Main extends Thread{public static void main(String[] args) {//每隔3秒执行一次这个线程/*while (true) {try {Thread.sleep(3000);System.out.println("this is thread1");} catch (InterruptedException ex) {e.printStackTrace();}}*///3秒以后执行次线程try {Thread.sleep(3000);System.out.println("3秒后执行此线程");} catch (InterruptedException e) {e.printStackTrace();}}}
?