Java Inheritance is a property of Object-Oriented Programming Concepts by which we can access some methods of a class in another class. The class whose methods is inherited know as Parent class/ Base class/ Superclass, and the class which is derived from Parent class is known as Child class/Subclass.

Java Inheritance Example

The concept behind inheritance in Java is that you can create the new classes that are built upon existing classes. When you inherit methods and properties from an existing class, you can reuse the methods and fields of a parent class. Also, you can add new methods and fields in your current class also.

Syntax

class base_class_name extends super_class_name
{  
   // code here like methods and fields
}

#java #java inheritance #object-oriented programming #parent class

Java Inheritance Example | Inheritance in Java
5.25 GEEK