Search code examples
javasubclasssuperclass

Multilevel inheritance in java


Suppose if a class A is superclass of sub class B and class B is a superclass for sub class C then which of the following statements should be used? And tell whether the statement not chosen is 'wrong' or is there any other reason?

Statement 1: sub class C has two/multiple superclasses 'A' and 'B'

Statement 2: sub class 'C' has only one superclass 'B'


Solution

  • I would say statement 2 is more accurate.

    Essentially B has access to all the protected/public fields/methods of A and C has access to all the protected/public fields/methods of A and B