You are on page 1of 8

Home

amd Fuudameutal ehod


s Methods Java
appr00t-DMaLed
Eyomply

Class Calculator 1 not attepie


ovea Par &waers but del
of Stark aud Heap Wr
int abC 1 t ne Ua-akl
's Colluho
ONethods Metkedy n JavaS Votd add (') Meto
a Spee -ho i p t ad ho otp-
nshukhons mat perpm
O al0
tas e
b:20
Mehd have Catbj
Szslen ouk intlale)
input lParamelers

( retam ype
Rablie Clas Calcalator

R.6e Stabe
Vard main (njI ) }
Temname(rameler Mettod Syutay Caltulatoil ,
CalcilatorCale -
htus

Crteh'on

Ackwih Bdy A Calc.add(;'- add Methed


i's Callad

feld are 1eferij|


i n stoa
babus, Pope1fa) 3
Sam
-)Mlloed Ackuty babasiouv,
Same
obyt yn o dela
Gale Nansgg
Calndatb eExe o
byleGade of Entive wwH prom
om.
Tvm 9ot Main u t h o d
TVm Cafle Do o Eye uto n
TVm ves
Calu cul s k aole madn Methoel
oH objat dn
dn ordey
orcday e be Creaad
Mana veCorcl w?0
one
areq
Stat
reCerd
of Main Matho ol (ov) $tatt
Java pvogram Tausvakou
exeels
thhod
o1il 0/ main Me
JVM
dala area
Gnd yectug
rane breughek huto
brougt
ato
it ara ng u Method

Tho
of Ma
atk area
P.betau Calealetor
eGs Colaaorl
PabCe stahi Vadwa
i n to b ;
Cclealsto 1 alc
=

eCaltl
void odd)

Slare anea Ccle.oddl


(o) HeP
ared.
Orea
eatb
pazenShonldyb r h t
So Pl
arkty/tesk
Any
in Slouk
area o7 Exekon
Slace area
whakeve thure Epea.lo

Gd of &kvew
TVM 9ot byk
auk'vak on Télorq (0o Methed
uoin
Steuk ane of
datEve
arbat & fhare ?n lesk orea Tnak uoU
ctar.Ereu
Get
Star E.
Ereab.
Obyet Creatin it apned
Memony wiu al»cbd fr
huap ona

on
nstante
Vawable Cabit ) Avra.
on wop .

o r obets Maa lotalrd


TVM

M a l n Muthodty clars Callator


a,bic
Void add (

C0,0

Cat
Sop
,
beedy of maih edtad
vought Jtadcarca

Vercsle Crexid
Ma (Pnt to obyeut

Saereme
of maln Method Heap Area
Area
Vlabk
3/von to dh ta-e
vahus ae

dlanLt c l e r e n l k

heap avea .
Cale.latbn10}

De
Calalata
Calt=
Cerad
reprene
On Slatk anea Mimory 77

Calc holds addre f 06Tet


onable rfering %
iseerenle ghatevor thert in Add ethod bro-
(1 Cal c a o fo
statk anta Stact cveq
of oljeut
on
ObTe addres
i t holds add mtMod wiu be Gead
Crealad
new Callator 3 1);
DStaut dome of
Calaator 2
ale
R t a b area ( Heap a r t
LYprenla
Var'cbl

add Method cleadd )J


Coll-g add method addt
Conbol pes -

Rsle chu Caliularhr!


clas Calaulab 1
RLle ckl vm Heap orea

fatabiC3 deetd v 0utp


Voie add(
Caalatn 1 Gde:
m alalebr10 dled
Clcadd t);
a-10

b- 10
Cat Aftr Ereakon d t ame ofadd
also frau of
o d get d l t e d ad
So'plU
dalkted.
Main MeHhad get

also dlkod
Abcdo-E reeret Vanálba (aloe)
Scans f heep avea
a b g e lolautor g
adsd nutsl ge t e cbyat no onis
add'y koond
L haap erta
for obrest
leap Scani)
a l ll
nuked ee
i's nefen : dkyat
wll
Glut t
Calkehr
Saukea dhalotatod
gbege
uiu be
ht
Mn
pr
teak b
A p p r a a d h - ( M e
s daingpara mekrs and a gvm ves
t h o
Con tol of
Encadrov.

Methad
attepg
ye stak tramge Main Mthod red
Stak
lamltolU1 Stcelc awtg
Class Calau&or 1 Pble clars obzestiGeakd. od Mno
area
o huap
Pouble Sek Valdman {tc Vonabla wiu
be alloaol
instau
in
nt res Calols tor1 Cale
=
nuo

Void add (int a,intb) al alsb1


mepobu fr mana4g obTak
res =atb
Calc.ad d(1o,1) % Relerent
Vaeba
o9
Vanzbla May
i u be Cresad
Re

a t k area

-ttholdoddres
of obyeut
lhabe Telor to objaut
(e-ferente
t ould be Cale w Calc.ltor
Caleleter2
2
eprs.
Mted aepkng peram
nw

ada
Colcalator 1
Cdc
Peferenu Vasiable

add mettod [lcele.


0 20)
add tt
ealli
Call to mehoda add mHed
addt t 3 y t
Cortrol of
Euecukon goe keh t
allud
3a sonu data
A h o d
Evpakng
pobja Peramatrs Carb)
a
Man)

eols'
aleadd ( 10 10)j
a e gver
Stat Avea
Heap a tat6)
anea.

taler- Void add (atPavanAe t s


Vech
Num
oLdd ald Stauc rans.
Metho dStak en Nethad apProath 3)
t oo e¬xee Cvealaol 0n Ptatk
method
of add aalo caud
locali d Cal calaton1 Puloe deu lunth Cole1f
Vavlabh Cla
MEO o loal PabLc Ctabe Void rain[

e n statt dam n t ab,Yes

intkol
ou Su tn af Calalat 1 Colt hew (alsttov10
outut int add C
Eveio Cale addt
Momoy teley thod Value
add t h o d
Execuro o/ int e= Cale. add &);
wU e ol aluested o Plc)
r atb;
retur re 1

deloed partukr
ler Ey esahion
acterkng
i t 's hot
dokod ealloed a Vale
nust
ue
Sta @yea
paramaler s
atugfing etuming
4if
mehod
Esging Gn
i
1Cotol. to Cale-add (o,o).
Coas e
pavamelors
s to a tske 6) hot
alo dezlataliod
dallotakol itigapto
franadd
mehod also 9Va talke
Valu
t
L m s y of maj
M nd
ih hcep arèa. VaricLu C
to obyut
n o
on 1ev hod
obyal,od
Gabetoy Collots
e
at Cale addi )
( gbay
unr of tt
ol ollocab
8 Num
LOCk

Methd Appro4th- gkale arla MMAy sto Cal Va. reo ae


Craad
P.Lbe elas launehaled Eyeaken Memo oAdd to.d
Clas, Calaepr P H
AuLl'e Itakt Void mainti Mithod ge debllocatus
Pt add lita it5) dand Ha
O Calaulator 1 Cle =ns
Guds "a obget ond
nt rej atb Colulaa geubeg
olonlr
alc: addl);
retunr3 alloest MMoy of t
ntre= Cale a d E
tonihg MEthod
S0'P(rs4) B:bh s

VotdVoidadd
Parenuers.
od F t Calc add ),
hee Mthod attephhg a l0
: addMatLod
Tetunig a Valu Catb Calld.
Splc "Vale
and hot rekmiug
paraltr
detepkag

e res
20)
Void ada
(inka itb)aCalt ad (10
ba
Crali
,e-E T 6
Cal So'plres)

Sakfra He-p area

int add C)i


m a i n

Ovca
Mhod t ltadd1),

(
Crealeo
a sto
tC celtvadd 1
b vo
e v e in SLelk qk Epe Cukeol. ru E a t
1whasever
area
a r e a

o l g e t is leabd an hap there ado


mtod. t adld Ciat 4 iutb){ ale add (t0,20)
to add t re
Conbr o t gkuk
area
an
i t ve atb
ttod is bvgt S-op (re)
gyecubd
Num
8 BachspaCe Lock
Mithod
6sgbl Nays of uWnng
ree-hm pdeippetr R(21 1l2) : uS'32
and hot
parals

M Methed not atuepk t X= O 1213


wileh k )
a y Valnt
pf" dolanl ) ;
Voiod adld ) l ledl S.o
Calc add )3 ("o ) ;
a0 Cae0 ' S o P
b 20 add Mettod r's break
C qt
So Pl) Calld

s Ouo not return


Method acteas parcmi Y0 p 20

oy Vabhe yzl / p I 2 - fal-twey


y.jnl yes
Void manl
hto,t b)
Booon b tns Rinih,
ek,
rey a t ) bob b btuie ofpratnv
S.oP res) b3 tue

N1
fltbb I(6,¢ba)Eba)
MeHod hot ateh Hrcmteus q but reh rop(alpha )j a
^f
Walue
t Cbitlu)|(b, ¬ba) l(b11:))
w add()1 I Glc addl); S oP"beka");
aLo
iutcCalvaddt)j
h o outb
So Pl)

Method attepPh parametey


Pt add nka jink 6) 1 alC:add
fnk vey =

int res 4tbj


o P(ves)

You might also like