ExamVeda
Login
Home
This question belongs to Java Program Threads
Threads
?

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

public class Test{		
      public static void main(String... args){	
            A a = new A();
       Thread t = new Thread(a);
       t.setName("good");
       t.start();
      }
}

Answer & Solution
Correct Answer: Option A

Thread.currentThread().getName() return name of the current thread.

Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.