Can you override a protected method in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at Adobe, Lives in San Jose, CA
If a method cannot be inherited, then it cannot be overridden. A subclass within the same package as the instance's superclass can override any superclass method that is not declared private or final. A subclass in a different package can only override the non-final methods declared public or protected.
2023-05-13 12:30:24
评论(499)
Helpful(122)
Helpful
Helpful(2)

Lucas Rodriguez
QuesHub.com delivers expert answers and knowledge to you.
If a method cannot be inherited, then it cannot be overridden. A subclass within the same package as the instance's superclass can override any superclass method that is not declared private or final. A subclass in a different package can only override the non-final methods declared public or protected.