A

Admin • 831.35K 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: 20
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
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.

Be the first to start discuss.