I have the following:
public static void menu () throws java.io.IOException{
int option;
do{
out.println("1. Sing");
out.println("2. Eat");
out.println("3. Sleep");
out.println("4. Wake up");
out.println("6. Out");
option=Integer.parseInt(in.readLine());
selOption(option);
} while (opcion != 6);
}
public static void selOption (int option) throws java.io.IOException {
switch (option){
case 1:
objectVariable.sing();
break;
case 2:
eat();
break;
case 3:
sleep();
break;
case 4:
wakeUp();
break;
default:
break;
}
}
what i'm looking is a method that, if I select sleep(), will disable the first two options of the switch (sing() and eat()), but if I select wakeUp(), will enable the two options again.
I know that CountDownLatch might work, but I'm not sure how to use it properly.
Reference on CountDownLatch: Implement a blocking function call in Java
Thank you.