SlideShare a Scribd company logo
How do I use inheritance in Java?
Index
What is Java inheritance
Example of Java inheritance
Keywords Extends
Prepared By
Preeti
Java class supports reuse through inheritance and composition. This
two-part tutorial shows you how to use inheritance in your Java
programs. In Part 1, Learn how to use the extends keyword to derive a
child from a parent class. In part 2 you will visit java.long.Object, this is
the superclass of Java, from which any other class inherits.
All freshers who willing to make career in java ,Java certification
course is a essential to all freshers.
To complete your knowledge about inheritance, check my Java tip, if
you want to use composition vs inheritance.
Learn why composition is an important addition to inheritance and how
to use it to avoid encapsulation problems in your Java programs.
To complete your knowledge about inheritance, check my Java tip, if
you want to use composition vs inheritance.
Learn why composition is an important addition to inheritance and how
to use it to avoid encapsulation problems in your Java programs.
Java Inheritance: Two Examples
Inheritance is a programming construct that software developers use to
create is-a relationships between categories.
By inheritance, we can derive more specific categories from more
generic ones. The more specific category is a type of generic category.
For example, a current account is a type of account where you can
deposit and withdraw funds.
Similarly, a truck is a kind of vehicle for towing large objects.
Inheritance can descend through multiple levels, leading to more and
more specific categories.
As an example, figure shows the number 1 car and truck inherit from
vehicle; Combi inherit from car, and garbage truck inherit from truck.
Arrows show from more specific "child" categories (below) to less
specific "parents"categories (above).
Figure 1. A few inheritance hierarchies are rooted in the common
vehicle category
This example demonstrates single inheritance in which a child category
inherits state and behavior from an immediate parent category.
In contrast, multiple inheritance a child category to inherit state and
behavior from two or more parent categories.
The hierarchy in Figure 2 illustrates the Multiple Inheritance.
https://www.exltech.in/java-training.html
Figure 2.
Hovercraft multiply inherits from land vehicle and watercraft categories
Categories are described by classes.
Java supports single inheritance through class extension, in which a
class inherits directly accessible fields and methods from another class
by extending this class. However,
Java does
When you view an inheritance hierarchy, you can easily detect multiple
inherits by the presence of a diamond pattern.
Figure 2 shows this pattern in the context of vehicle, land vehicle,
watercraft and hovercraft.
The keyword extends
Java supports the class extension using the extends keyword. If present,
extends specifies a parent-child relationship between two classes.
Below I use extended to a relationship between the classes vehicle and
car, and then between Account and SavingsAccount:
Exltech is offering Practical Java course training in Pune with hands on
experienced in coding.
Vist us to know more details about Java course
https://www.exltech.in/

More Related Content

PDF
What are Generics in Java | Java Generics Tutorial | Edureka
PPTX
Java syntax-and-grammars-oct8
PPTX
Inheritance
PDF
IRJET- Inheritance in Java
PDF
java_vyshali.pdf
PPTX
Java OOPS Concept
PDF
Introduction to Inheritance in Java for presentation
PPTX
Java interview-quetions
What are Generics in Java | Java Generics Tutorial | Edureka
Java syntax-and-grammars-oct8
Inheritance
IRJET- Inheritance in Java
java_vyshali.pdf
Java OOPS Concept
Introduction to Inheritance in Java for presentation
Java interview-quetions

Similar to How do i use inheritance in java? (20)

PDF
java inheritance that is used in oop cls
PPTX
Inheritance in Java - An Introduction & types
PPTX
Inheritance,single,multiple.access rulepptx
PPTX
Java presention Inheritance present By Showrov Ahamed
PPTX
Inheritance-in-Java.pptxxxxxxxxxxxxxxxxx
PPTX
Inheritance in OOPs with java
PPTX
SAD04 - Inheritance
DOCX
159747608 a-training-report-on
PPTX
Multiple inheritance in java3 (1).pptx
PPTX
Inheritance in Java beginner to advance with examples.pptx
PPT
Inheritance and its necessity in java.ppt
PDF
How to Implement Hierarchical Inheritance in Java: A Step-by-Step Guide
PPTX
INHERTANCE , NARROW AND WIDENING
PDF
4th_class.pdf
PPTX
Inheritance in java
PPT
Java_notes.ppt
PPTX
Lecture 12
PPTX
ITTutor Advanced Java (1).pptx
PPT
Unit 3 Java
DOCX
Java Interview Questions For Freshers
java inheritance that is used in oop cls
Inheritance in Java - An Introduction & types
Inheritance,single,multiple.access rulepptx
Java presention Inheritance present By Showrov Ahamed
Inheritance-in-Java.pptxxxxxxxxxxxxxxxxx
Inheritance in OOPs with java
SAD04 - Inheritance
159747608 a-training-report-on
Multiple inheritance in java3 (1).pptx
Inheritance in Java beginner to advance with examples.pptx
Inheritance and its necessity in java.ppt
How to Implement Hierarchical Inheritance in Java: A Step-by-Step Guide
INHERTANCE , NARROW AND WIDENING
4th_class.pdf
Inheritance in java
Java_notes.ppt
Lecture 12
ITTutor Advanced Java (1).pptx
Unit 3 Java
Java Interview Questions For Freshers
Ad

More from kritikumar16 (10)

PPTX
How do i implement command design pattern in the java programming course with...
PPTX
When to use abstract class and methods in java
PPTX
How do i use inheritance in java?
PPTX
5 things about introduction to advanced java you have to experience it yourself.
PPTX
How do i use inheritance in java?
PPTX
List of 7 popular java frameworks for 2019
PPTX
What is java polymorphism and its types in java training?
PPTX
How do i implement command design pattern in the java programming course with...
PPTX
List of 7 popular java frameworks for 2019
PPTX
Introduction to advanced java
How do i implement command design pattern in the java programming course with...
When to use abstract class and methods in java
How do i use inheritance in java?
5 things about introduction to advanced java you have to experience it yourself.
How do i use inheritance in java?
List of 7 popular java frameworks for 2019
What is java polymorphism and its types in java training?
How do i implement command design pattern in the java programming course with...
List of 7 popular java frameworks for 2019
Introduction to advanced java
Ad

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
01-Introduction-to-Information-Management.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Lesson notes of climatology university.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Institutional Correction lecture only . . .
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
01-Introduction-to-Information-Management.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Module 4: Burden of Disease Tutorial Slides S2 2025
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Lesson notes of climatology university.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Anesthesia in Laparoscopic Surgery in India
O7-L3 Supply Chain Operations - ICLT Program
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial diseases, their pathogenesis and prophylaxis
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Institutional Correction lecture only . . .
Abdominal Access Techniques with Prof. Dr. R K Mishra
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf

How do i use inheritance in java?

  • 1. How do I use inheritance in Java?
  • 2. Index What is Java inheritance Example of Java inheritance Keywords Extends
  • 4. Java class supports reuse through inheritance and composition. This two-part tutorial shows you how to use inheritance in your Java programs. In Part 1, Learn how to use the extends keyword to derive a child from a parent class. In part 2 you will visit java.long.Object, this is the superclass of Java, from which any other class inherits. All freshers who willing to make career in java ,Java certification course is a essential to all freshers. To complete your knowledge about inheritance, check my Java tip, if you want to use composition vs inheritance. Learn why composition is an important addition to inheritance and how to use it to avoid encapsulation problems in your Java programs.
  • 5. To complete your knowledge about inheritance, check my Java tip, if you want to use composition vs inheritance. Learn why composition is an important addition to inheritance and how to use it to avoid encapsulation problems in your Java programs. Java Inheritance: Two Examples Inheritance is a programming construct that software developers use to create is-a relationships between categories. By inheritance, we can derive more specific categories from more generic ones. The more specific category is a type of generic category. For example, a current account is a type of account where you can deposit and withdraw funds. Similarly, a truck is a kind of vehicle for towing large objects.
  • 6. Inheritance can descend through multiple levels, leading to more and more specific categories. As an example, figure shows the number 1 car and truck inherit from vehicle; Combi inherit from car, and garbage truck inherit from truck. Arrows show from more specific "child" categories (below) to less specific "parents"categories (above). Figure 1. A few inheritance hierarchies are rooted in the common vehicle category This example demonstrates single inheritance in which a child category inherits state and behavior from an immediate parent category.
  • 7. In contrast, multiple inheritance a child category to inherit state and behavior from two or more parent categories. The hierarchy in Figure 2 illustrates the Multiple Inheritance.
  • 8. https://www.exltech.in/java-training.html Figure 2. Hovercraft multiply inherits from land vehicle and watercraft categories Categories are described by classes. Java supports single inheritance through class extension, in which a class inherits directly accessible fields and methods from another class by extending this class. However, Java does
  • 9. When you view an inheritance hierarchy, you can easily detect multiple inherits by the presence of a diamond pattern. Figure 2 shows this pattern in the context of vehicle, land vehicle, watercraft and hovercraft.
  • 10. The keyword extends Java supports the class extension using the extends keyword. If present, extends specifies a parent-child relationship between two classes. Below I use extended to a relationship between the classes vehicle and car, and then between Account and SavingsAccount:
  • 11. Exltech is offering Practical Java course training in Pune with hands on experienced in coding. Vist us to know more details about Java course https://www.exltech.in/