ojo - Oviented preguemmng font
Tay Concept focuses on srenpLifyng
Complex, Systems ty eepres citi) :
essential a ators and er unnecessary |
etalls TH helps mansge Com ple fy and Promotes
a Cleo Frterjoce .
Ans Is
1 Abstvaction t
D+ Class and Objects? DOP Ia bared oO” the Conceph 2
Classes and Object , Chasses deine the
bloc paiok ov temptate jor objects , otle objets
aie fater Pustances a Chass +
3: Grcapsutodion § This Concept Invelves Igond Mus dota
and methocs thor opesates ov Hott
data wid a Slugte uWt . Tt enforces
asta, Wawa | and abstraction ,enhonclug dec
and modotostt te . :
4. Trheritance & Tx altos 9 Neo Class -to Inhe
propertion and behoviorrs, gro ¢
exiativg Coors . I promotes Code
beboeen (EWE
S: Polymowphiam? Tt evobtes olects «
Clorses to be eo ae
Common Superctass t
OverstcLi ,
_ flenibtly ond
6. Dynami « Bindlegs \n COP
ot wordime , altoudng
Synamie lind wo \sah alae
J
° DIY Aeutiabe b/s obsteadt ae gust e . oe
te Arbosbsuct kee
methods ,
| ogee eter
abateact methods ,
e Subclased must Provide Concrete
Jos abstract methods ,
ywoord fe Used to dectoe
AE Chassed o*
Frstantiated 1 ond +he
4 May Coben
J
frnplemeudadior
Java
absheact Chass Shape $
abstsact void deat) ff
Abstract method
Ss
| Claas “Ctscle extends Shape J
Veid dra (). 9
3 pehy %
Systern coud. pant In (" Drawing a Cede ) y
ee
Clos matn Ry
ee public Ctatid Veld
ex
cl amp) § @
| as oe tt Shape Shape = Nes
CS) Mh Gero’ -Cahinot inifete an t
| i j _ abstea ct Chass a
4s Crete C ‘i
civete = wes
t Shape
Ciscte. dear Cy,> Methed Muecsdvdten 6 7
e r
Qo» Static keyword ty used ito dectere, Vardabtes
f phe e ee
ox methods het betovg to the
gy the Chass.
(tow , not pratances |
oe Yatic membous Can be accessed trslyg the Class rame
itthout reat eg objects.
ava
Chace Math Utits ¥
Static int acd Cinta, Int b ) 5
1
rsetusn ath }
; 3
Public Chass Main $
public Statte Votd
inadn (Steing Cd a~gs) o
int Sem =
MoahVtis add (53) 5
System. oubs privat In ("Sem " ¢ Sem ) 5
%
§
3+ Finod keyooed ts used fo dectare Vaml
methods o» Uemed that Cannot b
Ovesidden ,o* eoxtenced,
s Fina Vortable Connet be veastlgned
Canned be wvenvidden , and a
extended ,
Java
Class CivcleSyste out pstattin (CAveg 4! +h * wea "ta
Pulotic Chass Maly a
Public Stetie veld
Mech in (String C3 args) ¢
Civcte Cirele = neo Chelet J)
Circle . pI Die la ,
Connet 7 modify 4 Final Voriable
Cxsor) |
|=> Metedd Raa Bd MOT
' 2) ave ty kaon as g pleffan —neutrel (rupuage becatiyg,
; i 1B r90, estgrad fo un on an any platform. ov ofestig
SGAHm —ubloolt mecleficotion thes poder Herdra li
y ve es |
(tS acheved Haougl he Use af He Jove Vafeab
Machine (JVM)
‘
Deva Byfelode | 1dlan you Coyle a jove propre
it fa vot Competecl olirectly into platforn-sfeaffe
maine tole. hstead it is Compiled rato an
Prtomediate fom Called Joa Syfelede..
This Byfelede. 5 Fatfom Indspoost
2) Jove Virkal Mathie C IVA)
Java afblicationg dw erecuted by fh JUM wick
b ffotfow peciic rurbne evurronecd . Each platform hay
Lts oda JUMY fnparwitetion , Machiug bat thay ale
Unolerstood and ba execute hom
Lyfecede tafe machine Co
42 Teta on.
Bie oe Te JOH thovstaes
ee for the HeHfie [esforn,
lon port of lene Veen Mookie ,
Tu J
VAs g Crile postal tor Java Platfow
Cal tt Cruits of sereral Conperadh >ae
ni loader * The Clary loader x rerforsile Jor leading
| Cle and tutorfacc oh recht Jt load, 5
classes fiom fir cls pe & veuftes fir.
2) Ruwbine Doda Aven’ Tle Runde Data Area
dy the rrensty abe tppar fe JVM alloctes
Iremory for Vartows hating, OH
ip comets of fle Methed arta , heap, J™* stechs,
Q nette methed stacks.
(2 Decuton Begnas The Cecio. Ba bs vefoyhle Pr
ened i animale §+ inclubty
Hoe (ust Tims) CIID) bombil , lich Pevslates ;
bute Code fifo Nakive Machine Coco fe better
wee
popenan ee, : hee ‘ i
4) Native Juerface The, ved te Interface provi
| oe, for fave progioms & trlaact bite
WMative [(brabies rtf tr (ouguags Uke
5s) Wate Metled! lybrssses | Thuy Wbaarles
fonfed, Netive MeKecl hat xe Uacol Ye
Sater with the Unilertairg Dfeudi
framevork fiat allovs hoa
th te JVM to doll Rte Geechplarcect{ors & |ibyahiey.
ey fertres of Jere
Javea hes Several feadores fhod woke 4 fopuleor
aad foverfudl Pel ent} Se
d fletfoon — Sncteperdence
Seer eats = Jaa bb 4 P (aber pap
atloveg 4 fo Atm om “4
wlth “2 compifable JVM,
2) Dbject Drferded : Joa na preely Chyect Orrested
I hath promote, te HF clsvok objeck
for steuchoig Code «
2) Stings ie Easy. devet's Sylar fe Anlecte CR CH,
uoking dt crebetiiely OH do lesan for developers .
4) Robust ° Jere cludes fester Uke audonotie
mesg pa Cyprbage Cltecton 1, Cacelton telly
& Shs igfe ay fe help ape Q prevent
errors at Compile tre Be Matt .
5) Gene, Jana bes bbl Sorel, feakoes
Ihe bade & byte Coe verification 0
lyf — Praicfers Coole.
7
ant 1) ey(leiled ti seme cog”
thet Other Methedy on Piel are “Aichertied.
Constuckore any Shetek Methools used fa Ahilteliga
bh jects of « cless dnd hey Re Lota pote
He Chassis Juterface that & Vtble Js sud-cleszes,
Hows Cut, toe are Ailes and fethauista fiat alles
@ sb clays 40. Coll a pared clan's
lorstrucfor alaig fhe prsceys of Crete ig, ae
objet. | ‘3 ‘
Goo aches tee SAMMI Gh ieee He
Gratonctors af dts farm Clats
but am Smpliiclt tall fo Supen Class
can call fle Contre iter
aphaile ei Beet, ng j
fhe Cerstruckr af Super Clab> rmbt cd
befine te (ostractr df tte Sub clogs
dp ye coalThedford) stale net a
The SuperC)t mat be He fii apes 1 |
qhe long 7UL for of ple
Bert | |
G The this" aad ‘ouper’ ky words, Oru
soserved words. dog plore
Sbbey, ,
SuhA_C)
The Cusrent bit me 4 te
port Clay js pad
oxy fe Spor eyusord
a0
the cusracd tatance
of the Clays p. efraaded
| by Huds keg Wore
= od pulrte GU te Bef te
a Drder fo ol the lancer fe A ponent |
depardt (on seretor T Clore. comer the |
| of Pe loner (lain 02 Gm | Suber ee 3 |
Use Ai, opto
“the “lds lomstancter
sport The Gere
object
Z j4 & Used Ww Invsk4
te Capen Ones
qa w wd poet fF
ke “fa. porwuatalgpd :
aeeacar its
aH> Method Oversidlaa t Te - a
; ee con 7
Recnrng Thread be “1
” .
)- By en, thread Class’ Se can be aun by evoking a
Ynstonee. of the class and Call i#s stavtC) meshed.
implement si
public class Main entends Treads §
public. Static yord Mam Cstringl tysdd
Mairy +h = meio Hot dd)
‘ah. stased (2)
Sastem, out. prota Cli thaend. 2}
° . -insteooe
D fy Runnable interface , Jk sun by fomed at all
Jars 40 qroead Object Constructor fe Ther call t | :
: d
chet) Method -
public clas Hain inploner Kumabl ,
public state Vote Hale Cstrikg C SJarga dt
main obf= mew Mail /
cqhecad th mers fiscead Cohj 9,
gna Stat © a r
. «so? ('Theuad; org
Dub ic val tur ff R
ppt pee Saat
: 1 *
5
Method Ovesriclaa ? TH - = ay
] Loti iat
4 (ike Progen hak Creates Sheds fc ib whl
ah for’ ? diffrent darks |
lars —TarkA implements Qurwable.
pullic void yunt) £
gout CM Thswad tour!)
Pept Ae
Thoued sleep (3000;
j
Cage (SateouteGneptin e) &
e@. print stack hace;
ioe
S0.01.7 Ci Tlocadl wy ff
“Jak & ymplements Runreble {
puslic vodlol ie run
Cle
SoU TeSort | he ¢ mA
e. prie-ctedefagal
5
Set (Stora 4h fisted’) 5. -
tls ,
Clos Task C -imgbleneats Russable £
pbc werd raOL
Sou tC" Thread © 6 Spotty)
Pe
Trad. sleep (1000) ;
3 ety hy, Es 0) E
jTeouad Yhayedth = 010 Thad (nex By
Tas ACD) )
Thad theeed B =z 420 Thad fs Sy
Fark BO);
fe
lod Hseed l= 128 Taco ee? i
: ee &
Txskee >) } i
b
{
FKasdh. sfot0) |
red 8 stat OF 4
tured C-stet ly
a peti geld |
red eh |
Hel - ph]
5 cath (rome &
ic pet sicck
5
S.0.4-T (HebMetind Ouexidlng 2 Tt occas +04 - a
Tu Diff. behvens ae yl) ad Let)
inetlods t flat
The unl) methed enecuteA the tere dr Pe Care
Thrtcd .igltch mass it does abt ceode 4 new
Prad . 4 i Gat 2 normal meth all fist
uns oe for ex: Parca unc), jn the
onan Hered wilh eneadte fre tak Ain fle
trade thrend & Meck unfill if frdstes.
Ta Goth) hetid Crete « 100 Horaol
A riche the HC) “ethed om fiat tired
Dhith Werks 14 <1 fret eek asypclasossly
fer en: Hoedf trl); in He mer fae
Ht ah create 4 new fread for
an, Seah | He
tle Otine GR ib Meader.
wi Gr pve wited> Method Ouewddlng § Th mrernxs ot
¢ Hayle +
Ans 5* “These, AAC Gous type of Inher |
Se A Chose Con Inher qven one |
. Srgde Inher fance*
m_ Substan SupenUess » Java Appts
Single inhewitance jer qeiases ,
9 Mulbiple Inhewitonce. *
4 than one Supertioss, Jove Support 4 only
Through interfaces not Aherough Chauke’s, |
tA Coss Con Hine from Won’ |
bi ModHievel \whedtancet Dn tts o Chose, Inherits,
grow another Cones , vohich Ls fom Inhestt4 |
dro onothen Coss , This yore 0 Choin 4 |
(whewtance F
Ws Hierarchical Inheritance + Tn dis multiple.
Csssea inherit droma Single Coes » It ‘
Ina teee Like tepetse where muss
Aubslosses shore a Common Super Ua)
Example of Single Inhewitance ==
Java
Chass Animod $ oe
Nola ce : oy
System vout. pratt in ("Ant
bagel
6
Chass Hey extends An\
Veld Io
System , oud. prin
APublic Clase
Inher} tance Erample ¥
public Static Votd
main CShing ea args )3
eo my Dog = new Dog oy,
my Dog » eat CJ lle
Inhewited Prom Animad Clacs
Di Bog » Pork ()
> Example Muttate Inhexitance ,
Java .
Intepace AY
Veid method AC)
5 : od eommreeg
Mtagoce Sas
Veld method & ¢J\
e
Usss My Class |mplements A, Oe :
pubuc veld method AC) 9
System cout, pric \n te Methad A ema
PR
pubic Cho se Ire
Mulitple Inhertance Boneh Fal
PU Stetic Ye
main (Stalag C3 ones) sal
My Cres ob}
My thos C)) aob} Methad AC) )
Ob). Method BC),
&
5
Exomple of Muttilevel Inheritance _
Java ‘
Ctass A §$
Veid method LC) >
System veut. priubln ("Methed A aj ClassA") }
5
g
Closs B extends A 3
Vold Method & OC) $
System .oud, pst In (“'Methed @ o} Cass B")*
5 '
8
Chass © Method Overddlng t Tt occurs wohen a Subetacs
7 7 provides a Specpic fiplementod:
Hon dev a method that tr aoe defined
fr tts Superchars . The ovenstdden method Pr
the cub elace Shoutd have the
Sedoey type
RX oud
Chocs Antmed a
Veld make Sound LY 4
| System oud, Pevtln (Animal makes a
| Aenesic Sound." 5
4
Chass Cot extends Animal %
@ @ Ove wide
Vold make Sound ()
System souk, pavtln ("Cot meows,
Same pame,
,
and parameters ,
ae CSoes
M24hed Overiding Crample o
public Modic Yoid
mosh { Steing CI anys) §
Cod my Cot
my Cot .make Sov
Ovewddden method
4