J

Jatin Dubey • 3.78K Points
Extraordinary

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
  • Correct Answer - Option(D)
  • Views: 118
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics