meu povo, pq q nessa questão o a linha t1.sleep(10000) está como se estivesse adormecendo o método main e a linha t1.interrupted não tá interrompendo p*** n****?
public class Teste extends Thread {
int y;
Teste(String nome, int i) {
super(nome);
this.y = i;
}
public void run() {
for (int i = 0; ; i++) {
try {
sleep(y);
} catch (InterruptedException e) {}
System.out.println(getName() + " - " + i);
}
}
public static void main(String args[]) {
Teste t1 = new Teste("t1", 500);
Teste t2 = new Teste("t2", 1000);
t1.start();
try {
t1.sleep(10000);
t1.interrupted();
} catch (InterruptedException e) {}
t2.start();
System.out.println("acabou!!");
}
}
