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

What will be the output of the following program code?
public class Test implements Runnable{
        public static void main(String[] args){
                Thread t = new Thread(this);
                t.start();
        }

        public void run(){
                System.out.println("test");
        }
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

2 Comments
HARSHITA RASTOGI
HARSHITA RASTOGI 8 years ago
'this' cannot be used in static context
https://www.quora.com/Why-cant-static-method-access-this-or-super-in-Java
Prachi Verma
Prachi Verma 9 years ago
correct option is ..option B.....because both run and start() are specified with no modifier.