Question: Consider the following Java code snippet: public class MyThread extends Thread { private int value; public MyThread ( int value ) { this . value

Consider the following Java code snippet:
public class MyThread extends Thread {
private int value;
public MyThread(int value){
this.value = value;
}
public void run(){
System.out.print(value);
}
public static void main(String[] args){
MyThread t1= new MyThread(1);
MyThread t2= new MyThread(2);
t1.start();
t2.run();
}
}
What will be the output of this program?
Note: There is a penalty of 10% for each incorrect try (selection followed by hitting Check)
Question 5Answer
a.
2
b.
1
c.
21
d.
12
e.
non-deterministic output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!