您的位置:首页 > 编程语言 > Java开发

一个简单的java Thread代码

2011-11-04 11:25 316 查看
public class myTread {

public static void main(String args[]){

myTread mt=new myTread();

t1 tt1=mt.new t1();

t2 tt2=mt.new t2();

Thread t= new Thread(tt1);

t.start();

t= new Thread(tt2);

t.start();

}

class t1 implements Runnable{

public void run(){

System.out.println("Son of a bitch of t1."+Thread.currentThread().getName());

}

}

class t2 implements Runnable{

public void run(){

System.out.println("Son of a bitch of t2."+Thread.currentThread().getName());

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: