package IO;
public class Test {
static void doSome(){
System.out.println("hhhhhhhhhhhhhhhh");
System.out.println(Thread.currentThread().getName());
}
public static void main(String[] args) {
A a1= new A();
A a2 = new A();
a1.setName("Aa1");
a2.setName("Aa2");
System.out.println(a1.getName());
System.out.println(a2.getName());
a1.start();
a2.start();
Thread thread = Thread.currentThread();
System.out.println(thread.getName());
Test a = new Test();
a.doSome();
}
}
class A extends Thread{
@Override
public void run() {
Thread thread = Thread.currentThread();
for(int j=0;j<100;j++){
System.out.println(thread.getName()+"---------->"+j);
}
}
}
版权声明:本文为qq_45858803原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。