Java MCQ Output based Questions - Constructor
In this article, we will cover some Java MCQ output based questions which will help extend your Java knowledge. Usually In Interviews nowadays, interviewer are more focused on negative questions rather than conceptual questions, and If you go through below questions, It will surely give you an add on and add value to your experience. Java MCQ Output based Questions Constructor in Java class First { public First() { System.out.println("a"); } } class Second extends First { public Second() { System.out.println("b"); } } class Third extends Second { public Third() { System.out.println("c"); } } public class MainClass { public static void main(String[] args) { Third c = new Third(); } } Output - a b c Explanation - While creating a new object of ‘Third’ type, before calling the default constructor of Third class, the default constructor of super class is called i.e, Second class and then again before the default constructor of super class, def...