1.
socew vo Object oienled
Object Oiented ogramrurg
Procedual. O'iented
Poogyamning - Object onened programming
where
" Pocedal oiented trogramg pngrammung style
main focus is on abjecto e
ting a proramthe
ds a woy o
kuncho, not gust buncions.
whene you tocus on It is way
ox procedurer to peBorm talso wnhing progzans by (reahig e
|06jects taat represent real-wde
Atep by step.
Hings.
(Jis cliz 4e patoYaheClale (aam ) |/Jooobiect lce chano turas
ICgo app (on hai. Lbana wa ho.
Java
6.1 Process vs Object Oriented
Procedural Oriented Programming Object Oriented Programming
Global Data Global Data Data
Gi Data
Functions Functions
Functionl Function 2 Function 3
Functions
Locel Locai Local
Data
Data Data Data
alobod Data+
Vaoiabley, tat ane declaed btside al funchony and qre
accenible om anyhene in te pogran. (30 aane funcion
by dejaut acey lan foye, ex: Bank Baluce
Example +
6.1 Process vs Object Oriented
Procedural Object Oriented
KNONVLEDKE
Withdraw,deposit, transfer Customer, money, account
7 Procednal Oriented Frogranmning| Object Onented Pogramig
focwserion funciorw(Aroceduse based) ocuse u abjec( data ++
yGlobal dota s thared by all funcohoe ac obiect Sunctons tog eth en)
hao ith Dor
Ley ecue because dota is dota and related hunchons.
peny acceibe Omore secue and modular
BeDiclt to manage in Jage
Longe (data i protrcded).
gplicatios. PEajier to sale debug nd
majntoun.
eexamle : C longuage
Erample: Java, C+t,ton
Customer Clastt Customer eltd
dota
Customen)
Age Funcdoas
ex;
D-0.B
PAN nO Trusheh
Aadhn no. ete
ava
6.2 Instance Variables and Methods
ADE
class
Class Cat
Properties Methods tcar
methods attributes
Four legs Lie
refuel) getFuel fuel
Mustache Mew setSpeedØ getSpeed0 maxspeed
drive)
Tail Jump
Fluffy Scratch
wlicl
we Con debine Unlimased prperrties but only trose
ane Televent to problem.
our
Propenties Can also be alled as Athbudet (so Dont Conhuse)
Propeniey Can be o too tjpes
G) oich does not lange ext moxspeed .
(2) wnicha Can be hanged. exi juel
nico bolerge
"Clar ke andn jo bhi clas li propenies hai
Tnstonce vvuobes o jo bi wslle method hai ertko
bolenge Tnstance Mehods.
b) Inside a Method (like main)
a) Inside a Class,but Outside Any Method
java
java public class Test {
public static void main (String[]
public class Test {
Car car = nev Car ("Red", "Maruti", args) {
3, 8000); // instance variable Car car = new Car("Red",
"Maruti", 3, 8000); // local variable
}
" Here, car is an instance variable.
Here, car is a local variable.