Programming in Java

Casual Mode - Take your time!

1 / 5
Correct
0
Incorrect
0
Score
0%
Multiple Choice

What is the output?
class sample4 extends Thread {
public static void main(String[] args) {
new sample4().start();
}
public void run() {
try {
System.out.println("Starting to wait");
wait(1000);
System.out.println("Done waiting, returning back");
}
catch(InterruptedException e) {
System.out.println("InterruptedException Found");
}
catch(Exception e) {
System.out.println("Exception found");
}
}
}

  1. Starting to waitGoes an infinite wait and deadlock
  2. Starting to waitException found
  3. Starting to waitDone waiting, returning back
  4. Starting to waitInterruptedException Found
  5. None of these
Change Mode