I need a solution from this lines of code i want to perform a 10 loops and at 10 i want it to system.exit(); where my GUI just exit itself, need help! currently this lines would just exit and it doesnt perform anything
int counter = 0;
while(true){
counter++;
for (int i = 0; i < 5; i++) {
if(counter < 10){
new Thread(new Person(bathroom, !isMale)).start();
new Thread(new Person(bathroom, isMale)).start();
}
else{
System.exit(0);
}
}