SlideShare a Scribd company logo
1 of 7
SUPREME
KNOWLEDGE
FOUNDATION GROUP
OF INSTITUTIONS
N A M E : AYA N D A S
S U B J E C T : OBJECT ORIENTED PROGRAMMING
PA P E R C O D E : PCC-CS503
D E PA R T M E N T : C O M P U T E R S C I E N C E A N D E N G I N E E R I N G
U N I V E R S I T Y R O L L N O : 2 5 3 0 0 1 2 1 0 5 7
Y E A R : 3 R D Y E A R
INHERITANCE IN JAVA
What is Inheritance ?
Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a
parent object. It is an important part of OOPS (Object Oriented programming system).
The idea behind inheritance in Java is that you can create new classes. that are built upon existing
classes. When you inherit from an existing class, you can reuse methods and fields of the parent class.
Moreover, you can add new methods and fields in your current class also.
Inheritance represents the IS-A relationship which is also known as a parent-child relationship.
IMPORTANT TERMINOLOGY:
• Super Class: The class whose features are inherited is known as superclass(or a base class or a
parent class).
• Sub Class: The class that inherits the other class is known as a subclass(or a derived class,
extended class, or child class). The subclass can add its own fields and methods in addition to the
superclass fields and methods.
• Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to create a new
class and there is already a class that includes some of the code that we want, we can derive our
new class from the existing class. By doing this, we are reusing the fields and methods of the
existing class.
TYPES OF INHERITANCE IN JAVA
• Single Inheritance
• Multilevel Inheritance
• Hierarchical Inheritance
• Multiple Inheritance
• Hybrid Inheritance
• Single Inheritance: When a class inherits another class, it is known as
a single inheritance.or subclasses inherit the features of one superclass. Like,
Dog class inherits the Animal class, so there is the single inheritance.
• Multilevel Inheritance: When there is a chain of inheritance, it is known
as multilevel inheritance. In Multilevel Inheritance, a derived class will be
inheriting a base class and as well as the derived class also act as the base
class to other class.
TYPES OF INHERITANCE IN JAVA
• Hierarchical Inheritance: When two or more classes inherits a single class, or ne class
serves as a superclass (base class) for more than one subclass., it is known as hierarchical
inheritance. example, Dog and Cat classes inherits the Animal class, so there is hierarchical
inheritance.
• Multiple Inheritance: In Multiple inheritances, one class can have more than one superclass
and inherit features from all parent classes. Please note that Java does not support multiple
inheritances with classes. In java, we can achieve multiple inheritances only
through Interfaces.
• Hybrid Inheritance: It is a mix of two or more of the above types of inheritance. Since java
doesn’t support multiple inheritances with classes, hybrid inheritance is also not possible
with classes. In java, we can achieve hybrid inheritance only through Interfaces.
TYPES OF INHERITANCE IN JAVA
Ayan Das_25300121057.pptx

More Related Content

Similar to Ayan Das_25300121057.pptx

Similar to Ayan Das_25300121057.pptx (20)

Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance and Polymorphism
Inheritance and PolymorphismInheritance and Polymorphism
Inheritance and Polymorphism
 
Inheritance
InheritanceInheritance
Inheritance
 
Multiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptxMultiple inheritance in java3 (1).pptx
Multiple inheritance in java3 (1).pptx
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Oops
OopsOops
Oops
 
OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)
 
Java programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- InheritanceJava programming -Object-Oriented Thinking- Inheritance
Java programming -Object-Oriented Thinking- Inheritance
 
Inheritance in Java
Inheritance in JavaInheritance in Java
Inheritance in Java
 
Inheritance in OOPs with java
Inheritance in OOPs with javaInheritance in OOPs with java
Inheritance in OOPs with java
 
Inheritance used in java
Inheritance used in javaInheritance used in java
Inheritance used in java
 
Inheritance VS Polymorphism.pptx
Inheritance VS Polymorphism.pptxInheritance VS Polymorphism.pptx
Inheritance VS Polymorphism.pptx
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 
Java inheritance
Java inheritanceJava inheritance
Java inheritance
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
ACM init() Day 6
ACM init() Day 6ACM init() Day 6
ACM init() Day 6
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Java - Inheritance Concepts
Java - Inheritance ConceptsJava - Inheritance Concepts
Java - Inheritance Concepts
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 

More from Ayan974999

States of a Process in Operating Systems
States of a Process in Operating SystemsStates of a Process in Operating Systems
States of a Process in Operating SystemsAyan974999
 
Firewalls and proxies are both use for security
Firewalls and proxies are both use for securityFirewalls and proxies are both use for security
Firewalls and proxies are both use for securityAyan974999
 
The International Space Station (ISS) is the largest space station to have ev...
The International Space Station (ISS) is the largest space station to have ev...The International Space Station (ISS) is the largest space station to have ev...
The International Space Station (ISS) is the largest space station to have ev...Ayan974999
 
AYAN DAS_57_SOFT COMPUTING.pptx
AYAN DAS_57_SOFT COMPUTING.pptxAYAN DAS_57_SOFT COMPUTING.pptx
AYAN DAS_57_SOFT COMPUTING.pptxAyan974999
 
software engineering.pptx
software engineering.pptxsoftware engineering.pptx
software engineering.pptxAyan974999
 
Computer Network.pptx
Computer Network.pptxComputer Network.pptx
Computer Network.pptxAyan974999
 
Numerical Methods.pptx
Numerical Methods.pptxNumerical Methods.pptx
Numerical Methods.pptxAyan974999
 
Gantt Chart.pptx
Gantt Chart.pptxGantt Chart.pptx
Gantt Chart.pptxAyan974999
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan974999
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan974999
 

More from Ayan974999 (11)

States of a Process in Operating Systems
States of a Process in Operating SystemsStates of a Process in Operating Systems
States of a Process in Operating Systems
 
Firewalls and proxies are both use for security
Firewalls and proxies are both use for securityFirewalls and proxies are both use for security
Firewalls and proxies are both use for security
 
The International Space Station (ISS) is the largest space station to have ev...
The International Space Station (ISS) is the largest space station to have ev...The International Space Station (ISS) is the largest space station to have ev...
The International Space Station (ISS) is the largest space station to have ev...
 
Name.pptx
Name.pptxName.pptx
Name.pptx
 
AYAN DAS_57_SOFT COMPUTING.pptx
AYAN DAS_57_SOFT COMPUTING.pptxAYAN DAS_57_SOFT COMPUTING.pptx
AYAN DAS_57_SOFT COMPUTING.pptx
 
software engineering.pptx
software engineering.pptxsoftware engineering.pptx
software engineering.pptx
 
Computer Network.pptx
Computer Network.pptxComputer Network.pptx
Computer Network.pptx
 
Numerical Methods.pptx
Numerical Methods.pptxNumerical Methods.pptx
Numerical Methods.pptx
 
Gantt Chart.pptx
Gantt Chart.pptxGantt Chart.pptx
Gantt Chart.pptx
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptx
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptx
 

Recently uploaded

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 

Recently uploaded (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

Ayan Das_25300121057.pptx

  • 1. SUPREME KNOWLEDGE FOUNDATION GROUP OF INSTITUTIONS N A M E : AYA N D A S S U B J E C T : OBJECT ORIENTED PROGRAMMING PA P E R C O D E : PCC-CS503 D E PA R T M E N T : C O M P U T E R S C I E N C E A N D E N G I N E E R I N G U N I V E R S I T Y R O L L N O : 2 5 3 0 0 1 2 1 0 5 7 Y E A R : 3 R D Y E A R
  • 2. INHERITANCE IN JAVA What is Inheritance ? Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPS (Object Oriented programming system). The idea behind inheritance in Java is that you can create new classes. that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also. Inheritance represents the IS-A relationship which is also known as a parent-child relationship.
  • 3. IMPORTANT TERMINOLOGY: • Super Class: The class whose features are inherited is known as superclass(or a base class or a parent class). • Sub Class: The class that inherits the other class is known as a subclass(or a derived class, extended class, or child class). The subclass can add its own fields and methods in addition to the superclass fields and methods. • Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to create a new class and there is already a class that includes some of the code that we want, we can derive our new class from the existing class. By doing this, we are reusing the fields and methods of the existing class.
  • 4. TYPES OF INHERITANCE IN JAVA • Single Inheritance • Multilevel Inheritance • Hierarchical Inheritance • Multiple Inheritance • Hybrid Inheritance
  • 5. • Single Inheritance: When a class inherits another class, it is known as a single inheritance.or subclasses inherit the features of one superclass. Like, Dog class inherits the Animal class, so there is the single inheritance. • Multilevel Inheritance: When there is a chain of inheritance, it is known as multilevel inheritance. In Multilevel Inheritance, a derived class will be inheriting a base class and as well as the derived class also act as the base class to other class. TYPES OF INHERITANCE IN JAVA
  • 6. • Hierarchical Inheritance: When two or more classes inherits a single class, or ne class serves as a superclass (base class) for more than one subclass., it is known as hierarchical inheritance. example, Dog and Cat classes inherits the Animal class, so there is hierarchical inheritance. • Multiple Inheritance: In Multiple inheritances, one class can have more than one superclass and inherit features from all parent classes. Please note that Java does not support multiple inheritances with classes. In java, we can achieve multiple inheritances only through Interfaces. • Hybrid Inheritance: It is a mix of two or more of the above types of inheritance. Since java doesn’t support multiple inheritances with classes, hybrid inheritance is also not possible with classes. In java, we can achieve hybrid inheritance only through Interfaces. TYPES OF INHERITANCE IN JAVA