Olá pessoal estou com uma dúvida aqui
na parte de Threads, será que alguém
pode me dar uma
ajuda? 
/*
* ThreadA tem o bloqueio de b
*/
public class ThreadA {
public static void main(String[] args) {
ThreadB b = new ThreadB();
b.start();
synchronized(b){
try{
System.out.println("waiting for b to complete...");
/*
* ThreadA(principal) passa a vez para o thread b???
*/
b.wait();
}
catch(InterruptedException ex){
ex.printStackTrace();
}
System.out.println("total is: " + b.total);
}
}
}
class ThreadB extends Thread{
int total;
public void run(){
synchronized(this){
for(int i = 0; i < 100; i++){
total += i;
}
}
/*
* Thread b notifica o Thread A (Thread principal)???
*/
notify();
}
}
[]'s.