码迷,mamicode.com
首页 > 编程语言 > 详细

匿名内部类创建多线程

时间:2017-04-04 22:03:06      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:线程   rri   ide   stat   err   void   logs   new   tar   

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

 

匿名内部类创建多线程

标签:线程   rri   ide   stat   err   void   logs   new   tar   

原文地址:http://www.cnblogs.com/flei/p/6666311.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!