Q. What is the result of compiling and running the following code?

Code:
class Base{
        private Base(){
                System.out.print("Base");
        }
}
public class test extends Base{
        public test(){
                System.out.print("Derived");
        }
        public static void main(String[] args){
                new test();
        }
}
  • (A) BaseDerived
  • (B) Derived
  • (C) Exception is thrown at runtime
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compilation Error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
210
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Jatin Dubey
Publisher
πŸ“ˆ
87%
Success Rate