文章标题

来源:互联网 发布:网络教育报名时间2016 编辑:程序博客网 时间:2024/05/20 07:20
class mythread extends Thread {    public void run() {        // TODO Auto-generated method stub        super.run();        while (true) {            try {                Thread.sleep(500);            } catch (InterruptedException e) {                // TODO: handle exception                e.printStackTrace();            }            System.out.println("extends: " + Thread.currentThread().getName());        }    }}class mythread1 implements Runnable {    public void run() {        // TODO Auto-generated method stub        while (true) {            try {                Thread.sleep(400);            } catch (InterruptedException e) {                // TODO: handle exception                e.printStackTrace();            }            System.out.println("runnable: " + Thread.currentThread().getName());        }    }}
0 0
原创粉丝点击