Question
class newthread implements Runnable {
Thread t;
newthread() {
t = new Thread(this,"My Thread");
t.start();
}
public void run() {
System.out.println(t);
}
}
class multithreaded_programing {
public static void main(String args[]) {
new newthread();
}
}
What is the output of this program?
class newthread implements Runnable {
Thread t;
newthread() {
t = new Thread(this,"My Thread");
t.start();
}
public void run() {
System.out.println(t);
}
}
class multithreaded_programing {
public static void main(String args[]) {
new newthread();
}
}
Answer: Option B
Was this answer helpful ?
None.
Output:
$ javac multithreaded_programing.java
$ java multithreaded_programing
Thread[My Thread,5,main]
Was this answer helpful ?
More Questions on This Topic :
Question 10.
Which of these method wakes up all the threads?
....
Submit Solution