发个多线程问题,求解
public class Test4 implements Runnable{
@Override
public void run() {
for(int i=0;i<10;i++){
System.out.println("A");
if(i==5){
System.out.println(500);
Thread.currentThread().interrupt();
}
}
}
public static void main(String[] args) {
Thread t=new Thread(new Test4());
t.start();
for(int i=0;i<1000;i++){
System.out.println("B");
}
}
}
public class Test4 implements Runnable {
Thread t = null;
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println("A");
if (i == 5) {
System.out.println(500);
t.interrupt();
}
}
}
public void info() {
t = new Thread(new Test4());
t.start();
for (int i = 0; i < 1000; i++) {
System.out.println("B");
}
}
public static void main(String[] args) {
new Test4().info();
}
}