SlideShare a Scribd company logo
Object Oriented
Programming
concepts
Concept
• Definition: Class is a blue print (Abstraction)
• Class defines
– State (Characteristics/Attributes)
– Behaviour
Java
• The basic unit of object-orientation in Java is Class.
Class – basis of all computation
State
Behaviour
Concept
• Have specific identity (Not a
blueprint)
• Have specific attributes (state)
and behavior.
Java
• Instance of a class
Objects
State
Behaviour
public class Car
{
/* Attributes that define the state of the class are declared here*/
/* These variables are called instance variables (or) member variables */
public String make;
public String model;
public String colour;
public float mileage;
public float distance;
/*Methods that define the behavior of the class are declared here*/
Class in Java
State
public class Car
Class: Car
Member variables (or)
Instance variables
Member methods
Access
Modifier
Keyword
Class name
(identifier)
//Methods that define the behavior of the class are declared here. Only these methods can access the
instance //variables or instance variables.
public void setMileage(){
//Code to set the current mileage of the car
}
public void chgDistance(){
//Code to update the distance travelled so far
}
public void dispDetails(){
//Code to view the details of the car
}
} // End of Class
Class in Java (Code continues…)
Behaviour
public static void main(){
Car c2 = new Car(“BMW”,”x3”,”Alphine-White”,15,0);
Car c3 = new Car(“Ferrari”,” GTC4Lusso”,”Giallo Modena”,4,0);
}
Objects in Java
Car c1 = new Car( “Hyuindai”,”Creta”,”Typhoon-silver”, 19,0 );
Class name
Object name
‘new’ - keyword for creating objects
Constructor - method to initialize an object
Parameters for constructor objects
Constructor
It is a special type of method in the
name of the class that initializes the
object.
Car
c1 c2 c3
We will discuss this
later(1)
Class and its objects
C1
Brand: Hyuindai
Model: Creta
Colour: Typhoon-Silver
Mileage: 19
Distance covered: 0
C2
Brand: BMW
Model: X3
Colour: Alphine-white
Mileage: 15
Distance covered: 0
C3
Brand: Ferrari
Model: GTC4Lusso
Colour: Giallo Modena
Mileage: 4
Distance covered: 0
Class: Car
Terms used in Object Oriented
Programming (OOP)
• Data encapsulation
Ability to combine state & behavior (member
variables and member methods) is called data
encapsulation.
• Data abstraction
Act of representing essential features without
including the background details or explanation.
(Generalization or Blue print)
Class: Car
Member variables (or)
Instance variables
Member methods
Terms used in Object Oriented
Programming (OOP)
• Class
Class is a blueprint of a set of objects that have
common structure and behavior.
• Object
An entity with specific identity, specific
characteristics and specific behavior.
An instance of a class.
Class: Car
Member variables (or)
Instance variables
Member methods
Terms used in Object Oriented
Programming (OOP)
• Polymorphism
Ability to take ‘many forms’ of the same
method.
• Inheritance
Derive part or all of the information from one
entity to another entity
We will discuss this
later
We will discuss this
later
 Special methods in Java that are called when an object is created.
 Used to initialize the objects.
 Name of the method is same as that of the class
 No explicit return type specified.
 There are two types
 Default constructor (Called when no constructor is defined in the class)
 Parameterized constructor
Constructor methods in Java
Constructor methods in Java
public class Car
{
//declare instance variables here
//define member methods here
Car (String mke, String mdl, String clr, float mile, float dist){
make= mke;
model= mdl;
colour= clr;
mileage= mile;
distance= dist;
}
Car (String mke, String mdl, String clr){
make= mke;
model= mdl;
colour= clr;
mileage= 0;
distance= 0;
}
}
public static void main(){
Car c1 = new Car(); //default constructor
Car c2 = new Car(“BMW”,”x3”,”Alphine-
White”,15,0); //Parameterized constructor-1
Car c3 = new Car(“Ferrari”,” GTC4Lusso”,”Giallo
Modena”); //Parameterized constructor-2
}
Polymorphism –
Three constructor
functions with
same name.
Levels of access
Public
Accessible to any other
class anywhere
Protected
Accessible to package
classes and any
subclasses that are in
packages
Default
Accessible to classes in
the same package
Private
Accessible only within
the class
Package-1
Class-1
Class-2
Class-3
Package-2
Class-A
extends
Class-1
Class-B
Class-C
• Class level
• Package level
• Other package
– Subclass level
• Other package
– Non subclass
level
public void setMileage()
public void chgDistance()
Access modifier
• private
• default*
• protected
• public
*default is not a
keyword
 OOP concepts
 Data encapsulation (or) Data hiding
 Data abstraction
 Polymorphism
 Inheritance
Things to remember
 Class is a blueprint of objects.
 Object is an instance of class.
 Member variables (or) instance variables in a class
 Member methods in a class
 Constructor methods
 Creating objects
Things to remember
Access modifiers

More Related Content

Similar to Object Oriented Programming concepts in JAVA (20)

Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
Gousalya Ramachandran
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
mrxyz19
 
Class and Object in java core programming
Class and Object in java core programmingClass and Object in java core programming
Class and Object in java core programming
rathoreravindra2112
 
Java
JavaJava
Java
nirbhayverma8
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
Danairat Thanabodithammachari
 
Unit3 part1-class
Unit3 part1-classUnit3 part1-class
Unit3 part1-class
DevaKumari Vijay
 
Classes, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptxClasses, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptx
DivyaKS18
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
D Nayanathara
 
java - oop's in depth journey
java - oop's in depth journeyjava - oop's in depth journey
java - oop's in depth journey
Sudharsan Selvaraj
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
Sujit Kumar
 
Java Classes fact general wireless-19*5.pptx
Java Classes fact general wireless-19*5.pptxJava Classes fact general wireless-19*5.pptx
Java Classes fact general wireless-19*5.pptx
IbrahimMerzayiee
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
Hùng Nguyễn Huy
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTORUNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
Java basics
Java basicsJava basics
Java basics
Shivanshu Purwar
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
siragezeynu
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
javaopps concepts
javaopps conceptsjavaopps concepts
javaopps concepts
Nikhil Agrawal
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
madhavi patil
 
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
Muhammad Hammad Waseem
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
mrxyz19
 
Class and Object in java core programming
Class and Object in java core programmingClass and Object in java core programming
Class and Object in java core programming
rathoreravindra2112
 
Classes, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptxClasses, Inheritance ,Packages & Interfaces.pptx
Classes, Inheritance ,Packages & Interfaces.pptx
DivyaKS18
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
D Nayanathara
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
Sujit Kumar
 
Java Classes fact general wireless-19*5.pptx
Java Classes fact general wireless-19*5.pptxJava Classes fact general wireless-19*5.pptx
Java Classes fact general wireless-19*5.pptx
IbrahimMerzayiee
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
Hùng Nguyễn Huy
 
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTORUNIT I 	OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
mohanrajm63
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
madhavi patil
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 

Recently uploaded (20)

Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Ad

Object Oriented Programming concepts in JAVA

  • 2. Concept • Definition: Class is a blue print (Abstraction) • Class defines – State (Characteristics/Attributes) – Behaviour Java • The basic unit of object-orientation in Java is Class. Class – basis of all computation State Behaviour
  • 3. Concept • Have specific identity (Not a blueprint) • Have specific attributes (state) and behavior. Java • Instance of a class Objects State Behaviour
  • 4. public class Car { /* Attributes that define the state of the class are declared here*/ /* These variables are called instance variables (or) member variables */ public String make; public String model; public String colour; public float mileage; public float distance; /*Methods that define the behavior of the class are declared here*/ Class in Java State public class Car Class: Car Member variables (or) Instance variables Member methods Access Modifier Keyword Class name (identifier)
  • 5. //Methods that define the behavior of the class are declared here. Only these methods can access the instance //variables or instance variables. public void setMileage(){ //Code to set the current mileage of the car } public void chgDistance(){ //Code to update the distance travelled so far } public void dispDetails(){ //Code to view the details of the car } } // End of Class Class in Java (Code continues…) Behaviour
  • 6. public static void main(){ Car c2 = new Car(“BMW”,”x3”,”Alphine-White”,15,0); Car c3 = new Car(“Ferrari”,” GTC4Lusso”,”Giallo Modena”,4,0); } Objects in Java Car c1 = new Car( “Hyuindai”,”Creta”,”Typhoon-silver”, 19,0 ); Class name Object name ‘new’ - keyword for creating objects Constructor - method to initialize an object Parameters for constructor objects Constructor It is a special type of method in the name of the class that initializes the object. Car c1 c2 c3 We will discuss this later(1)
  • 7. Class and its objects C1 Brand: Hyuindai Model: Creta Colour: Typhoon-Silver Mileage: 19 Distance covered: 0 C2 Brand: BMW Model: X3 Colour: Alphine-white Mileage: 15 Distance covered: 0 C3 Brand: Ferrari Model: GTC4Lusso Colour: Giallo Modena Mileage: 4 Distance covered: 0 Class: Car
  • 8. Terms used in Object Oriented Programming (OOP) • Data encapsulation Ability to combine state & behavior (member variables and member methods) is called data encapsulation. • Data abstraction Act of representing essential features without including the background details or explanation. (Generalization or Blue print) Class: Car Member variables (or) Instance variables Member methods
  • 9. Terms used in Object Oriented Programming (OOP) • Class Class is a blueprint of a set of objects that have common structure and behavior. • Object An entity with specific identity, specific characteristics and specific behavior. An instance of a class. Class: Car Member variables (or) Instance variables Member methods
  • 10. Terms used in Object Oriented Programming (OOP) • Polymorphism Ability to take ‘many forms’ of the same method. • Inheritance Derive part or all of the information from one entity to another entity We will discuss this later We will discuss this later
  • 11.  Special methods in Java that are called when an object is created.  Used to initialize the objects.  Name of the method is same as that of the class  No explicit return type specified.  There are two types  Default constructor (Called when no constructor is defined in the class)  Parameterized constructor Constructor methods in Java
  • 12. Constructor methods in Java public class Car { //declare instance variables here //define member methods here Car (String mke, String mdl, String clr, float mile, float dist){ make= mke; model= mdl; colour= clr; mileage= mile; distance= dist; } Car (String mke, String mdl, String clr){ make= mke; model= mdl; colour= clr; mileage= 0; distance= 0; } } public static void main(){ Car c1 = new Car(); //default constructor Car c2 = new Car(“BMW”,”x3”,”Alphine- White”,15,0); //Parameterized constructor-1 Car c3 = new Car(“Ferrari”,” GTC4Lusso”,”Giallo Modena”); //Parameterized constructor-2 } Polymorphism – Three constructor functions with same name.
  • 13. Levels of access Public Accessible to any other class anywhere Protected Accessible to package classes and any subclasses that are in packages Default Accessible to classes in the same package Private Accessible only within the class Package-1 Class-1 Class-2 Class-3 Package-2 Class-A extends Class-1 Class-B Class-C • Class level • Package level • Other package – Subclass level • Other package – Non subclass level public void setMileage() public void chgDistance() Access modifier • private • default* • protected • public *default is not a keyword
  • 14.  OOP concepts  Data encapsulation (or) Data hiding  Data abstraction  Polymorphism  Inheritance Things to remember
  • 15.  Class is a blueprint of objects.  Object is an instance of class.  Member variables (or) instance variables in a class  Member methods in a class  Constructor methods  Creating objects Things to remember