Programming Language › Java thread MCQ › Question #2308
Single Choice Not Set

QWhat is the output for the below code?
class A implements Runnable{
      public void run(){
            System.out.println(Thread.currentThread().getName());
      }
}

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

ID: #2308 Java thread MCQ 752 views
Question Info
#2308Q ID
Not SetDifficulty
Java thread MCQTopic

Choose the Best Option

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

  • A good ✔ ✖
  • B null ✔ ✖
  • C Compilation fails with an error at line 5 ✔ ✖
  • D Compilation succeed but Runtime Exception ✔ ✖
Correct Answer

Explanation

good

Share This Question

Challenge a friend or share with your study group.