Question: What will be the output of the below Java program? public class ThreadWaitTest { public static void main ( String [ ] args ) {

What will be the output of the below Java program?
public class ThreadWaitTest {
public static void main(String [] args){
System.out.print("1");
synchronized(args){
System.out.print("2");
try {
args.wait(); /* Line 11*/
} catch(InterruptedException e){}
}
System.out.print("3");
}
}
Question 8 options:
13
123
12
d. It fails to compile because the IllegalMonitorStateException of wait() is not dealt with in line 11.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!