Describe inheritance in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Describe inheritance in Java?

4th Jun 2017, 9:29 PM
Amponsah Afriyie Agyare
Amponsah Afriyie Agyare - avatar
2 Answers
+ 3
If I extend a class, I am the sub class. The class that I am extending is called the super class. (Terminology) I am now a smaller part of the super class. For example, If I am created as my super class, I can be casted to my sub class. What are some benefits? If I extend a class, I can now access all non-private members of the super class. If somebody wants to use the super class as a blue print for all sub classes, then I can override methods of the blue print if necessary. If the way I explained it was a bit confusing, I do suggest reviewing what SoloLearn has in the course they offer. I'm just a meatball afterall. If you are wondering what the point of it is, here's a practical example of inheritance/OOP. https://code.sololearn.com/cZKcrU0TrMtX/?ref=app Edit: Oups, that was the wrong link. Nobody saw that, ok, moving on. 👌😳
4th Jun 2017, 10:45 PM
Rrestoring faith
Rrestoring faith - avatar
0
multi inheritence isnt possible in java u can achieve it by interfaces
5th Jun 2017, 1:54 AM
Suhail Pappu
Suhail Pappu - avatar