您的位置:首页 > 其它

thread 线程执行顺序

2017-10-20 17:29 232 查看
public class test{

public static void main(String[] args) {

        Thread t =new Thread(){

            public void run (){

                pong();

            }

        };

        t.run();

        System.out.println("ping");
    }

static void pong(){

        System.out.println("pong");

    }

}

输出结果为  : pong  ping

理解: 线程被创建 只有调run方法才会执行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: