public class Thread4 { public static void main(String[] args) { //匿名实现多线程 //继承thread类 new Thread(){ public void run(){ for(int x=0;x<111;x++){ System.out.println(getName()+":"+x); } } }.start(); //实现runable new Thread(new Runnable() { @Override public void run() { for(int x=0;x<100;x++){ System.out.println("wwww"); } } }).start(); } }
时间: 2024-10-21 22:33:49