Question: 1. Consider the following java program to answer the questions given below [C02, C3 based on your understanding of inheritance and polymorphism. class Superclass

 1. Consider the following java program to answer the questions given below  

1. Consider the following java program to answer the questions given below [C02, C3 based on your understanding of inheritance and polymorphism. class Superclass { protected int x = 0; public SuperClass(int x) { } this.x = x; protected final void increment () { } x++; private void add(int y) { x += y; } public void display() { Marks: 3+3+2+4] } } System.out.println(x); public class SubClass extends SuperClass { public SubClass(int x) { } } super(x); public void display() { } increment(); super.display(); public static void main(String[] args) { SuperClass sc = new SuperClass(3); } sc.display(); sc = new SubClass(3); sc.display(); a) List the name of all methods that subclasses of Super Class inherit. b) List the name of all methods that are visible in subclasses of SuperClass (in other words, methods that can be called directly). c) List the name of all methods that may NOT be overridden by any subclasses of SuperClass. d) What gets displayed on the screen when the main method SubClass is executed?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!