MCQ Practice Single Best Answer Topic: Java Constructor and Methods

Q What is the output of the above program?
class Num  {
      Num(double x ){
              System.out.println( x ) ;
      }   
}
public class  Test  extends  Num   {
       public static void main(String[] args){
                  Num num = new Num( 2 ) ;
       }     
}

Question ID
#2176
Subchapter
Java Constructor and Methods
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • B 2.0
  • C Compile time error
  • D None of the above
Correct Answer: C

Explanation

Compile time error

Share This Question

Share this MCQ with your friends or study group.