You are on page 1of 5

RISHIT RASTOGI

CSE-IV
Q0346302422
JAVA
AIGNNEN- 02

) Difoohae bhn absrt chss and iotat.


be instanhatad on its
AbsBract clacs ’Anatstrack class is a class hat cannotLOb Concrei, rathods
mhods ab
0an and may Contair abbrack
nojacuAnirofaa. ia rlounchp n Jova thot zinilaw
o. toacks
abatroct mithodb,datuk muthodb, tokemhods,
but ondy oantains imlununtakor
and. constant dadayasons. t cannot'contoun any
mtodbo

2) nhsitanU3
doss’Ada% can oxtid ony oneabstract class,as ova doesntsuyr
Absrac conruos,mamtbet
mutipls inhuitane.Atstrock dlases can hare
olth abstnact mathod.
VOsiablus,ard non-akstract mithods alon
imblnt muhple inogoctsolnketats cannot hawe
>Can conhowe contants
ConstTUctorS or mumbot VosÑaHis,but th
ard mthodb.

onacdoss has some cornon urcRonai that reay


Atstrock dass>Usd 8ubdasses, but cach 'bubclass moy hane
bahaud anogyits
oon inpluotobon for Sore.muhodb.
is thak nudto adhaataa
forclasses
dto dilin, a contract mutipla.inhsilone kt.
Aaciic sofmathodb,eablrp
bhoiout n Jovo.

d'llunt acaa modiiou forts mnbws


Abstroc, dlass’Canhove fulic and otslrack and
’ Al mumys aHa,imblia
Inirojat
)Ohat is isla of ohootor n Java.
h Java, th nsanuo' hatoris wed tohuck ohtho an deot ls on islons. o a
cdass or îkeint.. k rehorns' true'i he oojct is on intos of the soited
þahalay olkanoisc't rurra'falw.
subriofacts;
Ckss or intoau, orono of is atdseb or
Exompu:
String str-"Hallo";
boolan result =slr instanuo Sthngs
ohothuy cÙect rlourtd by' ste
In this exanb, 'str ntanadt Stiog' chck,

0) Explin stak füa, andotsraut ayaord. nawa.


STATC3 nehod)
In java, the'safc kuqord is 08ed tod dass-lurel.mambus (voviatuA can
cdas itsclf ralthsy han to instanuof the, dasso Staßc muthodb be calud
that biong to tha SBake voiotios, and
sJlthot ohie an nitonu.o tadass , usiry he nare direckuy
Ld for oliy nwnods, conatants ,andfor marjiry shasad resoUrL.
hatmod aH CORTONdu
FINAL3 mthod ororiay.
in Jara, o woed to reat. conalanls,prernt
T 'fha' kuyaord. duclaudfalit cannotbe
mokus ados immukabla or unchangablaolfados is
and on ustd to Jbresnt constant
Fual voslabLs 0
ovoriddan by anyssubclass . eranhon.
Yolaas that sholdnit change diytbrgran
AeSTRACT8 class &adoss hat
lsiwÀto aeo otsrack dass and mithodb ,an atsBrock (matods Sthok
and may Contom ahstrock mathodb
caAtot be. fistonlaad onito oon atstrack mahod ha.mhod dtclohud
mbumnlaon) ab uLOb conoua mithods .An
CoNero bubdass,
itot atodupand t must be mpuned ony
Lhis buhu

and boMOr Loith tha 50m nae ohin acnutrudoror a

Inatans voiasus þovamub this(),


th AAe class, waing
be Uded to cau anothy consructor in
hod.It Can albo
Eampe:
hlo class Nyclass
brivalc int nom}

this.num= nom

Syien.ot-pritn ("Valut:"+hishun);33

dójct lis þrimay uxd toacuso bbecloss


tros toth bueass of thi augant to call the, sihHcass constrvckor from oa
Voiabls. ts qtn used
todb,constructor, and
Subcdoss conairvcgr bir 'sakC)'.
Exanps SubsuClass
bublo class 5u6Closs exands
holic SubClass ()

33
t is 5lrng Bojondaes. fxplain smithods and consrockor.
th.
t oirbuffor' dass in Java ioa mukabl, seqyuNKs, of chaactox lko similon to aalid
Siring dassJhut onoike ctrp,okccks of Sigbtfor canbe modtfed ajt hy
CONSTRTORS &
) Sringbufor()':Construskors an emphy strirg bufor sith an nkolcabacih of l6 charodsah.

3) Strirgbue(Gtig st)': Conatruts a. ahrybaifo hitiaicad. ith th contats o he

METHODS3

(dhsx ): Aonds heafed dhas to undo bgfor


3) afpund
chonctvaina bularing og
of this buffo
dtstu(izstat,it od): Rurgrs ha,
6) sguifedhosihon..
dletChHAA(it idu): Rumorts chotocisy ak
) ofthechoacs.
)rers): Rnse» t ondy
Ritiovys aruo striy kron slot idax foond.
8) swbstrio(itstoxt,nterna: of buifeoto
():Ratann,
RatiuS the, chuHocty Coont
4) lnçhO:

You might also like