SlideShare a Scribd company logo
Title Slide
• Mastering OOP in Java – Part 2
• Presented by: [Your Name]
• Institution: [Your Institution]
• Date
Inheritance
• Reuse class features using extends.
• Example:
• class Dog extends Animal { ... }
Method Overriding
• Redefine superclass method in subclass.
• Use @Override annotation.
Polymorphism
• Compile-time: Method Overloading.
• Runtime: Method Overriding.
• Example:
• int add(int a, int b); double add(double a,
double b);
Abstraction
• Abstract class: Partially implemented.
• Interface: Fully abstract.
• Example:
• abstract class Shape { abstract void draw(); }
Interface vs Abstract Class
• Abstract Class: Can have state.
• Interface: Only constants and abstract
methods.
• Interfaces allow multiple inheritance.
Case Study: Shape Class
• abstract class Shape { abstract void area(); }
• Rectangle, Circle extend Shape and implement
area().
Java Keywords in OOP
• this: Refers to current object.
• super: Refers to parent class.
• final: Prevents override.
• static: Shared across instances.
Best Practices in OOP
• Use private fields and public methods.
• Prefer composition over inheritance.
• Avoid repetition (DRY principle).
Summary and Activity
• Create abstract class Employee.
• Subclasses: Manager, Developer.
• Override displayDetails().

More Related Content

Similar to OOP_Java_Part2.pptxOOP_Java_Part1OOP_Java_Part1 (20)

PPTX
Pi j3.2 polymorphism
mcollison
 
PPTX
Pi j2.3 objects
mcollison
 
PPTX
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
PPTX
Pi j2.2 classes
mcollison
 
PPTX
inheritance.pptx
sonukumarjha12
 
PPTX
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
PDF
OOPs Concepts - Android Programming
Purvik Rana
 
PDF
The maze of Design Patterns & SOLID Principles
Muhammad Raza
 
PPTX
Java chapter 5
Abdii Rashid
 
PPTX
Presentation 3rd
Connex
 
PPSX
Core java lessons
vivek shah
 
PDF
3java Advanced Oop
Adil Jafri
 
PDF
First fare 2011 frc-java-introduction
Oregon FIRST Robotics
 
PPTX
Java - Inheritance_multiple_inheritance.pptx
Vikash Dúbēy
 
PPTX
12_oop templa.pptx
RokaKaram
 
PPT
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
PPTX
Modules 333333333³3444444444444444444.pptx
radhikacordise
 
PPT
Inheritance & Polymorphism - 1
PRN USM
 
PPTX
Introduction to oop
colleges
 
PPTX
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 
Pi j3.2 polymorphism
mcollison
 
Pi j2.3 objects
mcollison
 
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
Pi j2.2 classes
mcollison
 
inheritance.pptx
sonukumarjha12
 
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
OOPs Concepts - Android Programming
Purvik Rana
 
The maze of Design Patterns & SOLID Principles
Muhammad Raza
 
Java chapter 5
Abdii Rashid
 
Presentation 3rd
Connex
 
Core java lessons
vivek shah
 
3java Advanced Oop
Adil Jafri
 
First fare 2011 frc-java-introduction
Oregon FIRST Robotics
 
Java - Inheritance_multiple_inheritance.pptx
Vikash Dúbēy
 
12_oop templa.pptx
RokaKaram
 
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
Modules 333333333³3444444444444444444.pptx
radhikacordise
 
Inheritance & Polymorphism - 1
PRN USM
 
Introduction to oop
colleges
 
Inheritance in Java is a mechanism in which one object acquires all the prope...
Kavitha S
 

More from yatakonakiran2 (20)

PPTX
StringBuffer examples.pptxStringBuffer examples.pptxStringBuffer examples.pptx
yatakonakiran2
 
PPTX
String and StringBufferString and StringBuffer e examples.pptx
yatakonakiran2
 
PPTX
OOP_Java_Part1OOP_Java_Part1OOP_Java_Part1.pptx
yatakonakiran2
 
PPTX
Java_Arrays_Presentation-2aaaaaaaaaa.pptx
yatakonakiran2
 
PPTX
Java_Arrays_Paaaaaaaaaaresentation-1.pptx
yatakonakiran2
 
PPT
Java Fundamentals.pptJava Fundamentals.ppt
yatakonakiran2
 
PPTX
Operating_Systems_UNIT_Concept of an Operating System1.pptx
yatakonakiran2
 
PPTX
array2.pptxarrays conceptsarrays conceptsarrays concepts
yatakonakiran2
 
PPTX
array1.pptarrays conceptsarrays conceptsarrays concepts
yatakonakiran2
 
PPTX
a21.pptxa24.pptxArrays122a24.pptxArrays111
yatakonakiran2
 
PPTX
a1.pptxArrays1Arrays1Arrays1Arrays1Arrays1
yatakonakiran2
 
PPTX
c2ppt.pptxslidenoteseceslidenoteseceslidenoteseceslidenoteseceslidenotesece
yatakonakiran2
 
PPTX
c first pres.pptxslidenoteseceslidenoteseceslidenotesece
yatakonakiran2
 
PPTX
Arrays-from-Basics-to-Advanced final.pptx
yatakonakiran2
 
DOC
CPDS1-8UNITS.docCPDS1-8UNITS.CPDS1-8UNITS.docdoc
yatakonakiran2
 
DOCX
data structures Unit 3 notes.docxdata structures Unit 3 notes.docx
yatakonakiran2
 
PPT
into python.pptinto python.pptinto python.ppt
yatakonakiran2
 
PPTX
dataversitydatacatalogslidenotesslidenotesslidenotes
yatakonakiran2
 
PPT
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
yatakonakiran2
 
PPTX
Module8_DFMEA_Testing_Innovation_Creativity_v7Innovation_Creativity_v7Deliver...
yatakonakiran2
 
StringBuffer examples.pptxStringBuffer examples.pptxStringBuffer examples.pptx
yatakonakiran2
 
String and StringBufferString and StringBuffer e examples.pptx
yatakonakiran2
 
OOP_Java_Part1OOP_Java_Part1OOP_Java_Part1.pptx
yatakonakiran2
 
Java_Arrays_Presentation-2aaaaaaaaaa.pptx
yatakonakiran2
 
Java_Arrays_Paaaaaaaaaaresentation-1.pptx
yatakonakiran2
 
Java Fundamentals.pptJava Fundamentals.ppt
yatakonakiran2
 
Operating_Systems_UNIT_Concept of an Operating System1.pptx
yatakonakiran2
 
array2.pptxarrays conceptsarrays conceptsarrays concepts
yatakonakiran2
 
array1.pptarrays conceptsarrays conceptsarrays concepts
yatakonakiran2
 
a21.pptxa24.pptxArrays122a24.pptxArrays111
yatakonakiran2
 
a1.pptxArrays1Arrays1Arrays1Arrays1Arrays1
yatakonakiran2
 
c2ppt.pptxslidenoteseceslidenoteseceslidenoteseceslidenoteseceslidenotesece
yatakonakiran2
 
c first pres.pptxslidenoteseceslidenoteseceslidenotesece
yatakonakiran2
 
Arrays-from-Basics-to-Advanced final.pptx
yatakonakiran2
 
CPDS1-8UNITS.docCPDS1-8UNITS.CPDS1-8UNITS.docdoc
yatakonakiran2
 
data structures Unit 3 notes.docxdata structures Unit 3 notes.docx
yatakonakiran2
 
into python.pptinto python.pptinto python.ppt
yatakonakiran2
 
dataversitydatacatalogslidenotesslidenotesslidenotes
yatakonakiran2
 
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
yatakonakiran2
 
Module8_DFMEA_Testing_Innovation_Creativity_v7Innovation_Creativity_v7Deliver...
yatakonakiran2
 
Ad

Recently uploaded (20)

PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
community health nursing question paper 2.pdf
Prince kumar
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Ad

OOP_Java_Part2.pptxOOP_Java_Part1OOP_Java_Part1

  • 1. Title Slide • Mastering OOP in Java – Part 2 • Presented by: [Your Name] • Institution: [Your Institution] • Date
  • 2. Inheritance • Reuse class features using extends. • Example: • class Dog extends Animal { ... }
  • 3. Method Overriding • Redefine superclass method in subclass. • Use @Override annotation.
  • 4. Polymorphism • Compile-time: Method Overloading. • Runtime: Method Overriding. • Example: • int add(int a, int b); double add(double a, double b);
  • 5. Abstraction • Abstract class: Partially implemented. • Interface: Fully abstract. • Example: • abstract class Shape { abstract void draw(); }
  • 6. Interface vs Abstract Class • Abstract Class: Can have state. • Interface: Only constants and abstract methods. • Interfaces allow multiple inheritance.
  • 7. Case Study: Shape Class • abstract class Shape { abstract void area(); } • Rectangle, Circle extend Shape and implement area().
  • 8. Java Keywords in OOP • this: Refers to current object. • super: Refers to parent class. • final: Prevents override. • static: Shared across instances.
  • 9. Best Practices in OOP • Use private fields and public methods. • Prefer composition over inheritance. • Avoid repetition (DRY principle).
  • 10. Summary and Activity • Create abstract class Employee. • Subclasses: Manager, Developer. • Override displayDetails().