package seameo;
public class NewClass {
public static void main(String[] args) {
Thread kopasus = new Thread();
Thread marinir = new Thread();
int ibuHamil = 5;
int manula = 5;
int teroris = 15;
int nIbuHamil = 1;
int nManula = 1;
int nTeroris = 1;
int batas = ibuHamil + manula + teroris;
kopasus.start();
marinir.start();
boolean is = true;
while (is) {
try {
if (nIbuHamil <= ibuHamil) {
kopasus.sleep(1000);
System.out.println("IBU HAMIL yang terselamatkan: " + nIbuHamil);
nIbuHamil++;
} else {
if ((nManula - 1) == manula && (nTeroris - 1) == teroris) {
is = false;
} else {
if (nManula <= manula) {
kopasus.sleep(1000);
System.out.print("MANULA yang terselamatkan: " + nManula + "\t");
nManula++;
} else {
System.out.print("\t\t\t\t");
}
if (nTeroris <= teroris) {
marinir.sleep(1000);
System.out.print("MARINIR masuk membunuh teroris: " + nTeroris);
nTeroris++;
} else {
System.out.print("\t\t\t\t");
}
}
}
} catch (Exception ex) {
System.out.println("Terjadi kesalahan dalam penyelamatan");
}
if (!is) {
System.out.println("Infanteri melakukan finishing");
break;
}
}
}
}
eror min :(
ReplyDelete