Java中如何编写线程
Java中如何编写线程
发布时间:2025-06-27 20:36:50
Java中如何编写线程
Tread thread = new Thread;
多个线程
public class Double {
public static void main(String] args){
Mythread one=new Mythread();
Mythread two=new Mythread();
one.setName("线程一");
two.setName("线程二");
one.start();
two.start();
}
}
class Mythread extends Thread
{
public void run(){
System.out.println(this.getName());
}
}