SlideShare a Scribd company logo
4
Most read
10
Most read
11
Most read
Inheritance  in JAVA PPT
Contents 
• Introduction of Inheritance 3 
• Classes classification 4 
 Super class 
 Intermediate class 
 Child class 
• Relation between classes 5 
• Super class 6 
• Intermediate class 7 
• Child class 8 
• Types of Inheritance 9 
 Single Inheritance 
 Multilevel Inheritance 
 Hierarchical Inheritance 
• Single Inheritance 10 
• Multilevel Inheritance 11 
• Hierarchical Inheritance 12 
• Indirect Mechanism of Inheritance 13 
• A program demonstrating inheritance 14 
• Limitations 15
INHERITANCE 
• One of the most effective features of Oop’s paradigm. 
• Establish a link/connectivity between 2 or more 
classes. 
• Permits sharing and accessing properties from one to 
another class. 
• to establish this relation Java uses ‘extends’ keyword.
Category of Classes on the Basis of 
Inheritance 
Super class 
(base/parent/driver/inheritance/ 
ancestor class). 
Intermediate class 
(mediating/dual class). 
Child class 
(sub/associate/derived/inherited class).
Relation between classes
Super class 
Top located class 
Service provider 
(its properties accessed by all its lower level 
class).
Intermediate class 
Middle located class 
Having Dual policy 
(obtain properties of upper level class 
and transmit properties to lower level 
class).
Child class 
Bottom located class 
much benefitted class 
much loaded class 
properties of child class as well as 
class and parent class can be accessed by 
only the object of child class.
TYPES of INHERITANCE 
• Single Inheritance 
• Multilevel Inheritance 
• Hierarchical Inheritance
Single Inheritance 
• A structure having one and only one parent as well 
as child class. 
• Child class is authorized to access the property of 
Parent class. Syntax :
Multilevel Inheritance 
• Standard structure of Single 
Inheritance having one Parent, 
one or more intermediate and 
one child classes. 
• Child class as well as intermediate 
class may access the properties of 
upper level classes. 
Syntax :
Hierarchical Inheritance 
A structure having one parent 
and more child class. 
Child classes must be connected 
with only Parent class. 
Syntax :
Java Supports a special feature called interface. 
This feature helps to connect a class with more 
than one classes. 
For this type of connectivity java uses ‘implements’ 
keyword. Syntax : 
interface A{ 
……..} 
Interface B { 
____} 
class M { 
-------} 
class N implements A,B extends M{ 
===== 
_____------…………}
A Program demonstrating Inheritance in 
Java 
import java.util.*; 
import java.io.*; 
interface Prn1{ 
void Bits(int x);} 
interface Prn2{ 
void Bytes();} 
class Prn3{ 
void Mega(){ 
int x=5,y,i=1; 
long z=1; 
while(i<=10){ 
y=x*i; 
i++; 
//System.out.println(y); 
z=z*y; } 
System.out.println("Product of Table of 5 : "+z);}} 
class RPT extends Prn3 implements Prn2{ 
int x,y,z; 
void Bits(int a){ 
if(a%3==0) 
System.out.println("nnn"+a+" is modulated by 3.nn"); 
else 
System.out.println("nnn"+a+" is not modulated by 3.nn");} 
public void Bytes(){ 
Scanner S=new Scanner(System.in); 
x=10; 
System.out.print("Enter a no. for a rectangle width : "); 
y=S.nextInt(); 
z=x*y; 
System.out.println("nnArea of rectangle : "+x+"x"+y+"="+z); 
System.out.println();}} 
class Intrfc{ 
public static void main(String[] Arg){ 
RPT obj=new RPT(); 
obj.Bits(16); 
obj.Bytes(); 
obj.Mega();}} 
Output : 
16 is not modulated by 3. 
Enter a no. for a rectangle width : 20 
Area of rectangle : 10x20=200 
Product of table of 5 : 35437500000000
• Link is establish into single direction(Fig). 
Java not support Multiple 
inheritance as well as 
Hybrid inheritance. 
The extends keyword permits 
to connect a class with only one class. 
In Interface, properties are only declared and assined, 
but n’ver defined.
THANK YOU
Ad

Recommended

Inheritance in java
Inheritance in java
RahulAnanda1
 
Inheritance in java
Inheritance in java
Tech_MX
 
Interface in java
Interface in java
PhD Research Scholar
 
Inheritance ppt
Inheritance ppt
Nivegeetha
 
Inheritance
Inheritance
Sapna Sharma
 
Inheritance In Java
Inheritance In Java
Arnab Bhaumik
 
Applets
Applets
Prabhakaran V M
 
Cloud database
Cloud database
kishan alagiya
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
Polymorphism in java
Polymorphism in java
Elizabeth alexander
 
Java buzzwords
Java buzzwords
ramesh517
 
java interface and packages
java interface and packages
VINOTH R
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)
Dyah Fajar Nur Rohmah
 
Java interfaces
Java interfaces
Raja Sekhar
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Interface
Interface
kamal kotecha
 
Polymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Java(Polymorphism)
Java(Polymorphism)
harsh kothari
 
Inheritance
Inheritance
Selvin Josy Bai Somu
 
Dynamic method dispatch
Dynamic method dispatch
yugandhar vadlamudi
 
Encapsulation
Encapsulation
Githushan Gengaparam
 
This keyword in java
This keyword in java
Hitesh Kumar
 
Java package
Java package
CS_GDRCST
 
Super Keyword in Java.pptx
Super Keyword in Java.pptx
KrutikaWankhade1
 
Classes, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
Inheritance in Java is a mechanism in which one object acquires all the prope...
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
Java presention Inheritance present By Showrov Ahamed
Java presention Inheritance present By Showrov Ahamed
Md Showrov Ahmed
 

More Related Content

What's hot (20)

Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
Polymorphism in java
Polymorphism in java
Elizabeth alexander
 
Java buzzwords
Java buzzwords
ramesh517
 
java interface and packages
java interface and packages
VINOTH R
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)
Dyah Fajar Nur Rohmah
 
Java interfaces
Java interfaces
Raja Sekhar
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Interface
Interface
kamal kotecha
 
Polymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Java(Polymorphism)
Java(Polymorphism)
harsh kothari
 
Inheritance
Inheritance
Selvin Josy Bai Somu
 
Dynamic method dispatch
Dynamic method dispatch
yugandhar vadlamudi
 
Encapsulation
Encapsulation
Githushan Gengaparam
 
This keyword in java
This keyword in java
Hitesh Kumar
 
Java package
Java package
CS_GDRCST
 
Super Keyword in Java.pptx
Super Keyword in Java.pptx
KrutikaWankhade1
 
Classes, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 

Similar to Inheritance in JAVA PPT (20)

Inheritance in Java is a mechanism in which one object acquires all the prope...
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
Java presention Inheritance present By Showrov Ahamed
Java presention Inheritance present By Showrov Ahamed
Md Showrov Ahmed
 
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
saurabhthege
 
Inheritance in OOPs with java
Inheritance in OOPs with java
AAKANKSHA JAIN
 
Inheritance
Inheritance
disha singh
 
Inheritance and Interfaces
Inheritance and Interfaces
NAGASURESH MANOHARAN
 
IRJET- Inheritance in Java
IRJET- Inheritance in Java
IRJET Journal
 
java_vyshali.pdf
java_vyshali.pdf
Vyshali6
 
OOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programming
ssuserf45a65
 
Inheritance & interface ppt Inheritance
Inheritance & interface ppt Inheritance
narikamalliy
 
java inheritance that is used in oop cls
java inheritance that is used in oop cls
hassanshahzad1502
 
Inheritance in Java - An Introduction & types
Inheritance in Java - An Introduction & types
VijethaChandran
 
Inheritance
Inheritance
Siddhesh Palkar
 
inheritance, Packages and Interfaces.pptx
inheritance, Packages and Interfaces.pptx
Vanitha Alagesan
 
web program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
Java(inheritance)
Java(inheritance)
Pooja Bhojwani
 
Inheritance
Inheritance
yugandhar vadlamudi
 
INHERITANCE.pptx
INHERITANCE.pptx
HARIPRIYA M P
 
Inheritance in oop
Inheritance in oop
MuskanNazeer
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptx
Ayan974999
 
Inheritance in Java is a mechanism in which one object acquires all the prope...
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
Java presention Inheritance present By Showrov Ahamed
Java presention Inheritance present By Showrov Ahamed
Md Showrov Ahmed
 
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
saurabhthege
 
Inheritance in OOPs with java
Inheritance in OOPs with java
AAKANKSHA JAIN
 
IRJET- Inheritance in Java
IRJET- Inheritance in Java
IRJET Journal
 
java_vyshali.pdf
java_vyshali.pdf
Vyshali6
 
OOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programming
ssuserf45a65
 
Inheritance & interface ppt Inheritance
Inheritance & interface ppt Inheritance
narikamalliy
 
java inheritance that is used in oop cls
java inheritance that is used in oop cls
hassanshahzad1502
 
Inheritance in Java - An Introduction & types
Inheritance in Java - An Introduction & types
VijethaChandran
 
inheritance, Packages and Interfaces.pptx
inheritance, Packages and Interfaces.pptx
Vanitha Alagesan
 
web program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
Inheritance in oop
Inheritance in oop
MuskanNazeer
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptx
Ayan974999
 
Ad

Recently uploaded (20)

Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Nati1986
 
ENGLISh.pptxENGLISh.pptxENGLISh.pptxENGLISh.pptx
ENGLISh.pptxENGLISh.pptxENGLISh.pptxENGLISh.pptx
MervieJadeBabao
 
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
jenicahmendoza1
 
ENGLISh.pptxtausug.pptxtausug.pptxtausug.pptx
ENGLISh.pptxtausug.pptxtausug.pptxtausug.pptx
MervieJadeBabao
 
The Caribbean Challenge: Fostering Growth and Resilience Amidst Global Uncert...
The Caribbean Challenge: Fostering Growth and Resilience Amidst Global Uncert...
Caribbean Development Bank
 
Personal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptx
GedeJuliana2
 
Retail Store Scavenger Hunt experience!!
Retail Store Scavenger Hunt experience!!
Samally Dávila
 
Analysis of Tausog Language English.pptx
Analysis of Tausog Language English.pptx
MervieJadeBabao
 
Food Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptx
Sakthi Sundar
 
case ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentation
fortuneassey
 
Sample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdf
Joseph Juntilla
 
3rd Curriculum-Map in TLE 8 Original.docx
3rd Curriculum-Map in TLE 8 Original.docx
sachidanacabel
 
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy Los
 
The Love of a Father 06 15 2025.pptx
The Love of a Father 06 15 2025.pptx
FamilyWorshipCenterD
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
sethjamcam
 
What say you - ethical issues in research
What say you - ethical issues in research
ssuser8aff01
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
PEN TO PODIUM powerpoint presentation.pptx
PEN TO PODIUM powerpoint presentation.pptx
Vanessa accad
 
The Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysis
Dr. Anshula Garg
 
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Nati1986
 
ENGLISh.pptxENGLISh.pptxENGLISh.pptxENGLISh.pptx
ENGLISh.pptxENGLISh.pptxENGLISh.pptxENGLISh.pptx
MervieJadeBabao
 
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
jenicahmendoza1
 
ENGLISh.pptxtausug.pptxtausug.pptxtausug.pptx
ENGLISh.pptxtausug.pptxtausug.pptxtausug.pptx
MervieJadeBabao
 
The Caribbean Challenge: Fostering Growth and Resilience Amidst Global Uncert...
The Caribbean Challenge: Fostering Growth and Resilience Amidst Global Uncert...
Caribbean Development Bank
 
Personal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptx
GedeJuliana2
 
Retail Store Scavenger Hunt experience!!
Retail Store Scavenger Hunt experience!!
Samally Dávila
 
Analysis of Tausog Language English.pptx
Analysis of Tausog Language English.pptx
MervieJadeBabao
 
Food Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptx
Sakthi Sundar
 
case ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentation
fortuneassey
 
Sample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdf
Joseph Juntilla
 
3rd Curriculum-Map in TLE 8 Original.docx
3rd Curriculum-Map in TLE 8 Original.docx
sachidanacabel
 
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy Los
 
The Love of a Father 06 15 2025.pptx
The Love of a Father 06 15 2025.pptx
FamilyWorshipCenterD
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
sethjamcam
 
What say you - ethical issues in research
What say you - ethical issues in research
ssuser8aff01
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
PEN TO PODIUM powerpoint presentation.pptx
PEN TO PODIUM powerpoint presentation.pptx
Vanessa accad
 
The Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysis
Dr. Anshula Garg
 
Ad

Inheritance in JAVA PPT

  • 2. Contents • Introduction of Inheritance 3 • Classes classification 4  Super class  Intermediate class  Child class • Relation between classes 5 • Super class 6 • Intermediate class 7 • Child class 8 • Types of Inheritance 9  Single Inheritance  Multilevel Inheritance  Hierarchical Inheritance • Single Inheritance 10 • Multilevel Inheritance 11 • Hierarchical Inheritance 12 • Indirect Mechanism of Inheritance 13 • A program demonstrating inheritance 14 • Limitations 15
  • 3. INHERITANCE • One of the most effective features of Oop’s paradigm. • Establish a link/connectivity between 2 or more classes. • Permits sharing and accessing properties from one to another class. • to establish this relation Java uses ‘extends’ keyword.
  • 4. Category of Classes on the Basis of Inheritance Super class (base/parent/driver/inheritance/ ancestor class). Intermediate class (mediating/dual class). Child class (sub/associate/derived/inherited class).
  • 6. Super class Top located class Service provider (its properties accessed by all its lower level class).
  • 7. Intermediate class Middle located class Having Dual policy (obtain properties of upper level class and transmit properties to lower level class).
  • 8. Child class Bottom located class much benefitted class much loaded class properties of child class as well as class and parent class can be accessed by only the object of child class.
  • 9. TYPES of INHERITANCE • Single Inheritance • Multilevel Inheritance • Hierarchical Inheritance
  • 10. Single Inheritance • A structure having one and only one parent as well as child class. • Child class is authorized to access the property of Parent class. Syntax :
  • 11. Multilevel Inheritance • Standard structure of Single Inheritance having one Parent, one or more intermediate and one child classes. • Child class as well as intermediate class may access the properties of upper level classes. Syntax :
  • 12. Hierarchical Inheritance A structure having one parent and more child class. Child classes must be connected with only Parent class. Syntax :
  • 13. Java Supports a special feature called interface. This feature helps to connect a class with more than one classes. For this type of connectivity java uses ‘implements’ keyword. Syntax : interface A{ ……..} Interface B { ____} class M { -------} class N implements A,B extends M{ ===== _____------…………}
  • 14. A Program demonstrating Inheritance in Java import java.util.*; import java.io.*; interface Prn1{ void Bits(int x);} interface Prn2{ void Bytes();} class Prn3{ void Mega(){ int x=5,y,i=1; long z=1; while(i<=10){ y=x*i; i++; //System.out.println(y); z=z*y; } System.out.println("Product of Table of 5 : "+z);}} class RPT extends Prn3 implements Prn2{ int x,y,z; void Bits(int a){ if(a%3==0) System.out.println("nnn"+a+" is modulated by 3.nn"); else System.out.println("nnn"+a+" is not modulated by 3.nn");} public void Bytes(){ Scanner S=new Scanner(System.in); x=10; System.out.print("Enter a no. for a rectangle width : "); y=S.nextInt(); z=x*y; System.out.println("nnArea of rectangle : "+x+"x"+y+"="+z); System.out.println();}} class Intrfc{ public static void main(String[] Arg){ RPT obj=new RPT(); obj.Bits(16); obj.Bytes(); obj.Mega();}} Output : 16 is not modulated by 3. Enter a no. for a rectangle width : 20 Area of rectangle : 10x20=200 Product of table of 5 : 35437500000000
  • 15. • Link is establish into single direction(Fig). Java not support Multiple inheritance as well as Hybrid inheritance. The extends keyword permits to connect a class with only one class. In Interface, properties are only declared and assined, but n’ver defined.