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
πŸ’¬ Discuss
βœ… Correct Answer: (C) Compile time error
Explanation: The given program creates a class Num that has a constructor with a double parameter.
Explanation by: Priyanka Tomar
The given program creates a class Num that has a constructor with a double parameter.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
147
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Priyanka Tomar
Publisher
πŸ“ˆ
80%
Success Rate