0% found this document useful (0 votes)
26 views

Java Programming - Inheritance

Inheritance in Java allows one class to inherit properties like methods and fields from another class, forming a hierarchical relationship between classes. The subclass inherits from the superclass using the "extends" keyword, allowing the subclass to reuse methods and fields of the parent class and optionally add new ones. For example, a My_Calculation subclass could extend the Calculation superclass, inheriting its properties while also adding new methods and fields.

Uploaded by

Arvie Jay Lapig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Java Programming - Inheritance

Inheritance in Java allows one class to inherit properties like methods and fields from another class, forming a hierarchical relationship between classes. The subclass inherits from the superclass using the "extends" keyword, allowing the subclass to reuse methods and fields of the parent class and optionally add new ones. For example, a My_Calculation subclass could extend the Calculation superclass, inheriting its properties while also adding new methods and fields.

Uploaded by

Arvie Jay Lapig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Implement

inheritance in
accordance with
Java framework
Inheritance in Java
Inheritance can be defined as the
process where one class acquires the
properties (methods and fields) of
another. With the use of inheritance
the information is made manageable
in a hierarchical order.

Copying
PROPERTIES
Inheritance in Java
The class which inherits the properties
of other is known as subclass (derived
class, child class) and the class whose
properties are inherited is known as
superclass (base class, parent class).

Copying
PROPERTIES
extends Keyword

extends is a function
that allows you to inherit
the properties of a class.
extends Keyword
Following is the syntax of
extends keyword.
class Super {
.....
.....
}
class Sub extends Super {
.....
.....
}
Following is an example
demonstrating Java
inheritance. In this example,
you can observe two classes
namely Calculation and
My_Calculation.

You might also like