Suppose I have a code where it asks the user to give some input, something like this:
for (condition) {
System.out.println("Please give some input");
System.in.read();
} //lets say this loop repeats 3 times and i face a problem during second iteration
but I want to give the user a 60 second time limit, and then throw an exception (in this case, I think its TimeOutException
). How do I do that?