Learn Java Programming - Inheritance: Superclass and Subclass Tutorial

preview_player
Показать описание
I will begin this tutorial with the definition of the word derive, to receive or obtain from a source or origin. In order to understand inheritance, you will need to understand the relationship between a superclass and a subclass. A subclass is derived from a superclass; the subclass name is located to the left of the extends keyword. The subclass inherits the members of a superclass. The superclass name is located to the right of the extends keyword, and it is the class that will allow access to its members. The superclass does not inherit the members of a subclass.
In Java, a class can only have one direct superclass. If a class declaration does not contain the extends keyword, Java implicitly extends the Object class. When it comes to inheritance, the Object class is the granddaddy of them all. The Object class is at the top of the Java food chain - it has no superclass. A class can extend a class that extends another class that extends another class ... eventually a class will implicitly extend the Object class.
Рекомендации по теме
Комментарии
Автор

Thank you for explaining this. I can finally spend time with my family.

kevinbenavides
join shbcf.ru