SlideShare a Scribd company logo
Java Object Oriented Programming
Java Object Oriented Programming
Java Object Oriented Programming
*
Object Oriented Programming is a paradigm that provides many
concepts such as inheritance, data binding, polymorphism etc.
*
It simplifies the software development and maintenance by providing
some concepts:
Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
Any entity that has state and behavior is known as an object.
For example: chair, pen, table, keyboard, bike etc. It can be
physical and logical.
An object has three characteristics:
state: represents data (value) of an object.
behavior: represents the behavior (functionality) of an object
such as deposit, withdraw etc.
identity: Object identity is typically implemented via a
unique ID. The value of the ID is not visible to the external
user. But, it is used internally by the JVM to identify each
object uniquely.
*
Collection of objects is called class. It is a logical entity.
A class is a group of objects that has common properties. It is a
template or blueprint from which objects are created. A class in
java can contain:
data member
method
constructor
block
class and interface
*
When one object acquires all the properties and
behaviors of parent object i.e. known as
inheritance. It provides code reusability. It is used
to achieve runtime polymorphism.
*
When one task is performed by different ways i.e.
known as polymorphism. For example: to convense the
customer differently, to draw something e.g. shape or
rectangle etc.
In java, we use method overloading and method
overriding to achieve polymorphism.
Another example can be to speak something e.g. cat
speaks meaw, dog barks woof etc.
*
Hiding internal details and showing functionality
is known as abstraction. For example: phone call,
we don't know the internal processing.
In java, we use abstract class and interface to
achieve abstraction.
*
Binding (or wrapping) code and data together into a
single unit is known as encapsulation. For example:
capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is
the fully encapsulated class because all the data members
are private here.
*
By using standard Java naming conventions, you make your
code easier to read for yourself and for other
programmers. Readability of Java program is very
important. It indicates that less time is spent to figure out
what the code does.
*
Java follows camelcase syntax for naming the class,
interface, method and variable.
If name is combined with two words, second word will start
with uppercase letter always e.g. actionPerformed(),
firstName, ActionEvent, ActionListener etc.
*
*
If a class have multiple methods by same name but
different parameters, it is known as Method Overloading.
There are two ways to overload the method in java:
By changing number of arguments
By changing the data type
*
*
Constructor in java is a special type of method that is
used to initialize the object.
Rules for creating java constructor
There are basically two rules defined for the constructor.
Constructor name must be same as its class name
Constructor must have no explicit return type
*
Default constructor provides the default values to the
object like 0, null etc. depending on the type.
Java parameterized constructor
A constructor that have parameters is known as parameterized
constructor.
Why use parameterized constructor?
Parameterized constructor is used to provide different values to the
distinct objects.
*
There can be a lot of usage of java this keyword. In java,
this is a reference variable that refers to the current
object.
*
If subclass (child class) has the same method as declared in
the parent class, it is known as method o
Usage of Java Method Overriding
Method overriding is used to provide specific
implementation of a method that is already provided by its
super class.
Method overriding is used for runtime polymorphism
Rules for Java Method Overriding
method must have same name as in the parent class
method must have same parameter as in the parent class.
must be IS-A relationship (inheritance).

More Related Content

What's hot (20)

PPT
Java buzzwords
ramesh517
 
PPTX
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
PDF
Creating your own exception
TharuniDiddekunta
 
PPTX
Object-oriented programming
Neelesh Shukla
 
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
PPT
Object Oriented Programming Concepts
thinkphp
 
PPTX
oops concept in java | object oriented programming in java
CPD INDIA
 
PPTX
Constructor in java
Pavith Gunasekara
 
PPTX
Abstraction java
MahinImran
 
PPT
Abstract class in java
Lovely Professional University
 
PPTX
Operators in java
Then Murugeshwari
 
PPTX
Understanding java streams
Shahjahan Samoon
 
PPTX
Constructor in java
Hitesh Kumar
 
PPTX
Method overloading
Lovely Professional University
 
PPT
06 abstract-classes
Anup Burange
 
PPTX
concept of oops
prince sharma
 
PDF
Java programming-examples
Mumbai Academisc
 
PPTX
Static Members-Java.pptx
ADDAGIRIVENKATARAVIC
 
PPTX
encapsulation
shalini392
 
Java buzzwords
ramesh517
 
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
Creating your own exception
TharuniDiddekunta
 
Object-oriented programming
Neelesh Shukla
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Object Oriented Programming Concepts
thinkphp
 
oops concept in java | object oriented programming in java
CPD INDIA
 
Constructor in java
Pavith Gunasekara
 
Abstraction java
MahinImran
 
Abstract class in java
Lovely Professional University
 
Operators in java
Then Murugeshwari
 
Understanding java streams
Shahjahan Samoon
 
Constructor in java
Hitesh Kumar
 
Method overloading
Lovely Professional University
 
06 abstract-classes
Anup Burange
 
concept of oops
prince sharma
 
Java programming-examples
Mumbai Academisc
 
Static Members-Java.pptx
ADDAGIRIVENKATARAVIC
 
encapsulation
shalini392
 

Viewers also liked (12)

PPTX
Introduction to java
Veerabadra Badra
 
PDF
Object oriented programming
Hüseyin Ergin
 
PPSX
Concept of Object Oriented Programming
Prognoz Technologies Pvt. Ltd.
 
PPTX
From Selling 2 Books a Day, To 200 - How I Did It? - J. Thorn
Jim Kukral
 
PPTX
Interesting Concept of Object Oriented Programming
Prognoz Technologies Pvt. Ltd.
 
PDF
It Is Possible to Do Object-Oriented Programming in Java
Kevlin Henney
 
PPT
Java for C++ programers
Salahaddin University-Erbil
 
PDF
String handling(string class)
Ravi Kant Sahu
 
PDF
Java Inheritance
Rosie Jane Enomar
 
PPT
Java: Inheritance
Tareq Hasan
 
PPT
Object Oriented Programming with Java
Jussi Pohjolainen
 
PPT
Basic concepts of object oriented programming
Sachin Sharma
 
Introduction to java
Veerabadra Badra
 
Object oriented programming
Hüseyin Ergin
 
Concept of Object Oriented Programming
Prognoz Technologies Pvt. Ltd.
 
From Selling 2 Books a Day, To 200 - How I Did It? - J. Thorn
Jim Kukral
 
Interesting Concept of Object Oriented Programming
Prognoz Technologies Pvt. Ltd.
 
It Is Possible to Do Object-Oriented Programming in Java
Kevlin Henney
 
Java for C++ programers
Salahaddin University-Erbil
 
String handling(string class)
Ravi Kant Sahu
 
Java Inheritance
Rosie Jane Enomar
 
Java: Inheritance
Tareq Hasan
 
Object Oriented Programming with Java
Jussi Pohjolainen
 
Basic concepts of object oriented programming
Sachin Sharma
 
Ad

Similar to Java Object Oriented Programming (20)

PPTX
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
PDF
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
PPTX
Features of Object Oriented Programming.pptx
SwagatoBiswas
 
PDF
Java Programming - 04 object oriented in java
Danairat Thanabodithammachari
 
PDF
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
PPTX
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
PPTX
JAVA-PPT'S.pptx
RaazIndia
 
PDF
JAVA-PPT'S.pdf
AnmolVerma363503
 
PDF
Ah java-ppt2
Haja Abdul Khader A
 
PPT
packages and interfaces
madhavi patil
 
PDF
Oops concepts
ACCESS Health Digital
 
PPTX
Introduction to oop and java fundamentals
AnsgarMary
 
PPTX
Java PPT OOPS prepared by Abhinav J.pptx
JainSaab2
 
PPTX
Introduction to OOPs second year cse.pptx
solemanhldr
 
PPTX
Nitish Chaulagai Java1.pptx
NitishChaulagai
 
PPSX
Oop features java presentationshow
ilias ahmed
 
DOCX
Object Oriented Programming All Unit Notes
BalamuruganV28
 
PDF
MCA NOTES.pdf
RAJASEKHARV10
 
PDF
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Sakthi Durai
 
PDF
Java Programming Paradigms Chapter 1
Sakthi Durai
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Features of Object Oriented Programming.pptx
SwagatoBiswas
 
Java Programming - 04 object oriented in java
Danairat Thanabodithammachari
 
Cs8392 oops 5 units notes
Narayanan sockalinganathan
 
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
RaazIndia
 
JAVA-PPT'S.pdf
AnmolVerma363503
 
Ah java-ppt2
Haja Abdul Khader A
 
packages and interfaces
madhavi patil
 
Oops concepts
ACCESS Health Digital
 
Introduction to oop and java fundamentals
AnsgarMary
 
Java PPT OOPS prepared by Abhinav J.pptx
JainSaab2
 
Introduction to OOPs second year cse.pptx
solemanhldr
 
Nitish Chaulagai Java1.pptx
NitishChaulagai
 
Oop features java presentationshow
ilias ahmed
 
Object Oriented Programming All Unit Notes
BalamuruganV28
 
MCA NOTES.pdf
RAJASEKHARV10
 
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Sakthi Durai
 
Java Programming Paradigms Chapter 1
Sakthi Durai
 
Ad

More from University of Potsdam (20)

PPTX
Computer fundamentals 01
University of Potsdam
 
PPTX
Workshop on android apps development
University of Potsdam
 
PDF
Transparency and concurrency
University of Potsdam
 
PDF
Database System Architecture
University of Potsdam
 
PDF
Functional dependency and normalization
University of Potsdam
 
PDF
indexing and hashing
University of Potsdam
 
PDF
data recovery-raid
University of Potsdam
 
PDF
Query processing
University of Potsdam
 
PDF
Machine Learning for Data Mining
University of Potsdam
 
PPTX
Tree, function and graph
University of Potsdam
 
PDF
Sets in discrete mathematics
University of Potsdam
 
PPT
Set in discrete mathematics
University of Potsdam
 
PPT
Series parallel ac rlc networks
University of Potsdam
 
PPT
Series parallel ac networks
University of Potsdam
 
PPT
Relations
University of Potsdam
 
PDF
Relations
University of Potsdam
 
PPT
Propositional logic
University of Potsdam
 
PDF
Propositional logic
University of Potsdam
 
PDF
Prim algorithm
University of Potsdam
 
Computer fundamentals 01
University of Potsdam
 
Workshop on android apps development
University of Potsdam
 
Transparency and concurrency
University of Potsdam
 
Database System Architecture
University of Potsdam
 
Functional dependency and normalization
University of Potsdam
 
indexing and hashing
University of Potsdam
 
data recovery-raid
University of Potsdam
 
Query processing
University of Potsdam
 
Machine Learning for Data Mining
University of Potsdam
 
Tree, function and graph
University of Potsdam
 
Sets in discrete mathematics
University of Potsdam
 
Set in discrete mathematics
University of Potsdam
 
Series parallel ac rlc networks
University of Potsdam
 
Series parallel ac networks
University of Potsdam
 
Propositional logic
University of Potsdam
 
Propositional logic
University of Potsdam
 
Prim algorithm
University of Potsdam
 

Recently uploaded (20)

PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PPTX
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Introduction to Indian Writing in English
Trushali Dodiya
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Horarios de distribución de agua en julio
pegazohn1978
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Controller Request and Response in Odoo18
Celine George
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 

Java Object Oriented Programming

  • 4. * Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc.
  • 5. * It simplifies the software development and maintenance by providing some concepts: Object Class Inheritance Polymorphism Abstraction Encapsulation
  • 6. Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical. An object has three characteristics: state: represents data (value) of an object. behavior: represents the behavior (functionality) of an object such as deposit, withdraw etc. identity: Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But, it is used internally by the JVM to identify each object uniquely.
  • 7. * Collection of objects is called class. It is a logical entity. A class is a group of objects that has common properties. It is a template or blueprint from which objects are created. A class in java can contain: data member method constructor block class and interface
  • 8. * When one object acquires all the properties and behaviors of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
  • 9. * When one task is performed by different ways i.e. known as polymorphism. For example: to convense the customer differently, to draw something e.g. shape or rectangle etc. In java, we use method overloading and method overriding to achieve polymorphism. Another example can be to speak something e.g. cat speaks meaw, dog barks woof etc.
  • 10. * Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing. In java, we use abstract class and interface to achieve abstraction.
  • 11. * Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines. A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.
  • 12. * By using standard Java naming conventions, you make your code easier to read for yourself and for other programmers. Readability of Java program is very important. It indicates that less time is spent to figure out what the code does.
  • 13. * Java follows camelcase syntax for naming the class, interface, method and variable. If name is combined with two words, second word will start with uppercase letter always e.g. actionPerformed(), firstName, ActionEvent, ActionListener etc.
  • 14. *
  • 15. * If a class have multiple methods by same name but different parameters, it is known as Method Overloading. There are two ways to overload the method in java: By changing number of arguments By changing the data type
  • 16. *
  • 17. * Constructor in java is a special type of method that is used to initialize the object. Rules for creating java constructor There are basically two rules defined for the constructor. Constructor name must be same as its class name Constructor must have no explicit return type
  • 18. * Default constructor provides the default values to the object like 0, null etc. depending on the type.
  • 19. Java parameterized constructor A constructor that have parameters is known as parameterized constructor. Why use parameterized constructor? Parameterized constructor is used to provide different values to the distinct objects.
  • 20. * There can be a lot of usage of java this keyword. In java, this is a reference variable that refers to the current object.
  • 21. * If subclass (child class) has the same method as declared in the parent class, it is known as method o Usage of Java Method Overriding Method overriding is used to provide specific implementation of a method that is already provided by its super class. Method overriding is used for runtime polymorphism Rules for Java Method Overriding method must have same name as in the parent class method must have same parameter as in the parent class. must be IS-A relationship (inheritance).