-
What is the output of this program?
class newthread implements Runnable
{
Thread thread;
newthread()
{
thread = new Thread(this,"My Thread");
thread.start();
}
}
public class multithreaded_Example
{
public static void main(String args[])
{
new newthread();
}
}
-
- Runtime Error
- Compilation Error
- Thread[My Thread,5,main].
- My Thread
- None of these
Correct Option: B
Thread thread has been made by using Runnable interface, hence it is necessary to use inherited abstract method run() method to specify instructions to be implemented on the thread, since no run() method is used it gives a compilation error.