是启动线程和调用线程的run方法

来源:互联网 发布:财务报销软件集思图友 编辑:程序博客网 时间:2024/05/22 08:25
public class Test {    public static void main(String[] args) {        Thread t=new Thread(){            public void run() {                fun();                          };        };        //注意这里不是启动线程,这是调用Thread类的run方法,启用线程要用t.start()        t.run();        System.out.println("22222222");    }    static void fun(){        System.out.println("1111111");    }}输出111111122222222
阅读全文
0 0
原创粉丝点击