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();
    }
}

 

相关文章:

  • 2022-12-23
  • 2021-08-30
  • 2021-09-01
  • 2021-12-23
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案