Q. You have the following code in a file called Test.java
class Base{
public static void main(String[] args){
System.out.println("Hello");
}
}
public class Test extends Base{}

What will happen if you try to compile and run this?

  • (A) It will fail to compile.
  • (B) Runtime error
  • (C) Compiles and runs with no output.
  • (D) Compiles and runs printing
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compiles and runs printing
Explanation: This will compile and print "Hello".
Explanation by: Ranjeet
This will compile and print "Hello".

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
210
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
95%
Success Rate