OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED
PROGRAMMING
Object Oriented Programming is a style of writing programs that are structured on data members(attributes) and
behavior(methods) with creation of objects.
A class is basically a blueprint for creating objects. These have their own attributes (characteristics), and methods
(behavior).
A Class can be a parent of many objects while an object is a child of a class.
Inside the class closure {} variables are called attributes(data members) and the functions inside that get or set
functions are called methods.
What is a Class?
Object 2 (house 2)
Class (house blueprint)
Object 3 (house 3)
What is an Object?
•A variable is a name assigned to a value that is stored inside the system memory. The value can be updated during the
program execution.
•In Java programming, the variables used for the program need to declare them first.
•The variable is declared using a data type followed by the identifier name. The variable can be initialized at the time of
declaration or it can be assigned a value taken from the user during the program execution.
class Product
static methods
0 0 0
n1 n2 p
int
static variables
What is an Object? class Product
An object is an instance of a Java class, meaning it is a copy of a specific class.
n1 n2 p
int
Object P1 Object P2
0 0 0 0 0 0
n1 n2 p n1 n2 p
instance
methods int int
Types of Constructors
Parameters
Parameterized Constructor