Programming Language Java thread MCQ Question #2312
Single Choice Not Set

QGiven the code. What will be the result?
public class Test implements Runnable{
      public static void main(String[] args) throws InterruptedException{
            Thread a = new Thread(new Test());
            a.start();
        
            System.out.print("Begin");
            a.join();
            System.out.print("End");
      }
    
      public void run(){
            System.out.print("Run");
      }
}

ID: #2312 Java thread MCQ 841 views
Question Info
#2312Q ID
Not SetDifficulty
Java thread MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Compilation fails.
  • B An exception is thrown at runtime.
  • C "BeginRunEnd" is printed.
  • D "BeginEndRun" is printed.
Correct Answer

Explanation

"BeginRunEnd" is printed.

Share This Question

Challenge a friend or share with your study group.