File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Section13AbstractClasses/src Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ while interfaces focus on defining a contract for implementing classes.
7070When overriding an abstract method in a subclass, you can use the same access modifier as the abstract method or a less
7171restrictive one.
7272
73- This follows the general rule for method overriding in Java. For example, if an abstract method is declared as protected,
74- the overriding method in the subclass can be declared as protected or public, but not private.
73+ This follows the general rule for method overriding in Java. For example, if an abstract method is declared as
74+ protected, the overriding method in the subclass can be declared as protected or public, but not private.
7575
7676This allows for greater flexibility in the subclass while maintaining the contract defined by the abstract class.
7777
@@ -84,7 +84,8 @@ abstract class Parent {
8484
8585class Child extends Parent {
8686 @Override
87- public void method () { // Less restrictive, so it's allowed
87+ public void method () {
88+ // Less restrictive, so it's allowed
8889 // implementation
8990 }
9091}
You can’t perform that action at this time.
0 commit comments