多线程之初探

来源:互联网 发布:八进制转二进制算法 编辑:程序博客网 时间:2024/06/05 05:37
package cm.com.show;
/*
 *多线程之初探
 */
public class ThreadUse1 {


public static void main(String[] args) {
MyThread mt1=new MyThread("线程A");
MyThread mt2=new MyThread("线程B");
MyThread mt3=new MyThread("线程C");
mt1.run();
mt2.run();
mt3.run();
}


}
class MyThread extends Thread{
private String title;
public MyThread(String title)
{
this.title=title;
}
@Override
public void run()
{
for(int x=1;x<=5;x++)
{
System.out.println(this.title+"运行,x="+x);
}
}
}
0 0
原创粉丝点击