Sitemap
Harshh🎀

Harshh🎀

Inheritance in Java

Nov 21, 2024

--

  • It inherits the data from one class to another class.
  • We can achieve this by using the keyword “Extends & Implements.”
  • The only advantage is code reusability.
  • We can reuse the methods and fields.

Parent class → Base class → Super class child

Class → Derived class → Subclass

Properties of Inheritance:

Static variables, Instance variables, and Methods will be inherited.

Get Harshh🎀’s stories in your inbox

Join Medium for free to get updates from this writer.

Constructor and Private Data members will not be inherited.

Types of inheritance:

1) Single-level inheritance

2) Multi-level inheritance

3) Hierarchical inheritance

4) Multiple Inheritance

5) Hybrid Inheritance

--

--