- 1
Describe inheritance in Java?
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. đđł
0
multi inheritence isnt possible in java u can achieve it by interfaces