匿名内部类创建多线程

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();
    }
}
原文地址:https://www.cnblogs.com/flei/p/6666311.html