Ho isolato il problema al file Partita.java: tutti gli altri Thread.sleep() funzionano, ma appena lo decommento in Partita.java, sebbene ci sia throws InterruptedException, il prompt lancia quel messaggio con quel <init>.
codice:
public class Partita {
Squadra squadraA;
Squadra squadraB;
String a;
String b;
int w;
boolean s;
public boolean giocaSet(Squadra tu, Squadra pc, String a, String b, int w) throws InterruptedException {
squadraA = tu;
squadraB = pc;
this.a = a;
this.b = b;
this.w = w;
int punteggioA = 0, punteggioB = 0;
while ((punteggioA < w && punteggioB < w) || (punteggioA >= w && Math.abs(punteggioB - punteggioA) < 2) || (punteggioB >= w && Math.abs(punteggioB - punteggioA) < 2)) {
double azione = Math.random();
if (azione < 0.5) {
punteggioA++;
} else {
punteggioB++;
}
System.out.println(punteggioA + "/" + punteggioB);
Thread.sleep(500);
}
if (punteggioA > punteggioB) {
s = true;
} else {
s = false;
}
return s;
}
}
Strano anche che venga ignorato il catch del main()
codice:
public class PlayoffTest {
public static void main(String[] args) {
Playoff playoff = new Playoff();
try {
playoff.formaSquadre();
} catch (Exception e) {
System.out.println(e.getMessage() + " Programma terminato.");
}
}
}