P

Priyanka Tomar • 35.28K Points
Coach

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 ) ;
}
}

  • (A) 0
  • (B) 2.0
  • (C) Compile time error
  • (D) None of the above
  • Correct Answer - Option(C)
  • Views: 80
  • Filed under category JAVA

Explanation by: Priyanka Tomar
The given program creates a class Num that has a constructor with a double parameter.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics