A

Admin • 828.43K Points
Coach

Q. What is the result of the following program?

Code:
public static synchronized void main(String[] args) throws
InterruptedException {
Thread f = new Thread();
f.start();
System.out.print("A");
f.wait(1000);
System.out.print("B");
}
  • (A) It only prints A and exits
  • (B) It prints A and B with a 1000 seconds delay between them
  • (C) A will be printed, and then an exception is thrown.
  • (D) It only prints B and exits
  • Correct Answer - Option(C)
  • Views: 11
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.