Java specifier weaker access

Rules of Access Specifiers in Method Overriding

Access Specifiers Method Overriding: The only rule says: "The subclass overridden method cannot have weaker access than super class method". Let us see the above rule practically in Access Specifiers Method Overriding.

Output screen of Access Specifiers Method Overriding Protected display() method of Test class is overridden by Demo…