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

QWhat will happen after compiling and running following code?
class A implements Runnable{
      public void run(){
            System.out.println("run-a");
      }
}

1. public class Test{
2.       public static void main(String... args){
3.             A a = new A();
4.             Thread t = new Thread(a);
5.             t.start();
6.             t.start();
7.       }
8. }

ID: #2296 Java thread MCQ 1,450 views
Question Info
#2296Q ID
Not SetDifficulty
Java thread MCQTopic

Choose the Best Option

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

  • A run-a
  • B run-a run-a
  • C Compilation fails with an error at line 6
  • D Compilation succeed but Runtime Exception
Correct Answer

Explanation

Compilation succeed but Runtime Exception

Share This Question

Challenge a friend or share with your study group.