Multi Threading
© examsiri.com
Question : 15 of 44
Marks:
+1,
-0
What is the output if the main() method is run?
public class Starter extends Thread {
 private int x = 2;
 public static void main(String[] args)throws Exception {
  new Starter().makeItSo();
 }
 public Starter() {
  x = 5;
  start();
 }
 public void makeItSo() throwsException {
  join();
  x = x - 1;
  System.out.println(x);
 }
 public void run() {
  x *=2;
 }
}
Go to Question: