Methods cannot be inherited | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Methods cannot be inherited

When can we say that methods cannot be inherited?

21st Oct 2020, 7:05 PM
Mennatullah Mohamed Abdelmaqsoud
Mennatullah Mohamed Abdelmaqsoud - avatar
3 Answers
+ 1
when class is declared final it cannot be inherited. The methods declared as private in a public or protected class, cannot be inherited. Constructors cannot inherited. Final methods cannot be overridden. Static methods cannot be overridden, but can be redeclared in a sub class.
21st Oct 2020, 7:42 PM
Jayakrishna 🇮🇳
+ 2
If you declare methods as final then you are not able to override that methods
21st Oct 2020, 7:15 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
0
Thanks for replay
21st Oct 2020, 7:57 PM
Mennatullah Mohamed Abdelmaqsoud
Mennatullah Mohamed Abdelmaqsoud - avatar