Oggetto condiviso!!!
public class Prova extends Thread{
private static Integer auto=0;
public synchronized void entraNelParcheggio() throws InterruptedException{
while (auto>=2){
wait();
}
auto++;
}
public synchronized void esconoDalPacheggio(int esci){
auto--;
System.out.println("Sono uscito auto: "+esci);
notifyAll();
}
}