MCQ Single Best Answer Not Set

QWhat will be the output?
class A extends Thread{
      public void run(){
            for(int i=0; i<2; i++){
                  System.out.println(i);
            }
      }
}

public class Test{
      public static void main(String argv[]){
            Test t = new Test();
            t.check(new A(){});
      }
      public void check(A a){
            a.start();
      }
}

ID: #2302 Java thread MCQ 806 views
Question Info
#2302Q ID
Not SetDifficulty
Java thread MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 0 0
  • B Compilation error, class A has no start method
  • C 0 1
  • D Compilation succeed but runtime exception
Correct Answer: Option C

Explanation

0 1

Share This Question

Challenge a friend or share with your study group.