Java Assignment
Java Assignment
re
anyt) he
Wha es Java its tri Onee amd rIn
Matyse
8 Jvm Java ne) acU as a
un-Time e ne
Viyhua M
ha Tho orHyaly
Sun Jav pghGalions. Jum i one
Code Jum iS
in Jv
Ctls e mar e ffod pre(e
Envivonme
URE(Java Runhime
De & tu
Onte un Ayo hare)
Called hWORA (W
e
ppiolons ame
Java Oe
Ja va Cods C
C o m d e v elop
meaMS A Y O Y ) meN
other SaUa
an any
iE lo run
y hem Md CM eppee
lhis is a
othotdamy
adjustmenb.
naole Sytam
lecause of V
poSble
avs is ORA.
t ke cc
prorsmig langue*s
tdtjonal ve y t e
I e Se tbe
e onp ( e
PYogYams tnder yY
whon 1t pashc-loY
Code undlevsfood y a
tht S4me (oda
to yy te
so fyy
hadiore havdida7e, l d d
with differe
anotiey
machne
caufe an eve, o
Cede oil
undestonds
dife b C m d e v S h u e d
e Cohe
Code
have t o Y e compee
yoy
en hod )aye
ava,R, The Procve m Cem vexteto code Are
no
Javn fro8a
VaC
(Compi ler)
Byle o de
cle3File
MacOC
indo inur
Waeinave
n y hes O ontyhck orS
n
s
melvd t a
Aa A Contnc n Dan s i m i laY Coa
clam is Yeated
nvoke e hey an objek of tte
name
ho e came
ave me tieds CantnlCho
Onike
ha i clogs Cnd drs hae any Yetum
clos Test
TesC)
Coshructy losely
Jav ffods
Conutyycor: Simila tG me
Aq
No-
mo no
hawe CUn paramet
C6mAtrucfo May
av
ans
a9met). L a (outuch does not accopt
ConRfr Ctor
no-arSumen
iS knsWn a s
DAYa Mete i
cas Main
i
choY wrtt
no pora meker
Main () l Cosd
pnvate
Costucho is celle4)
System. o : prin
ysten-oupistdnC"yalue tf i:+obj.i )
et pa
Conttrucho 1 (led
Valuue is
Java Pvme Aexized Conefruc frr
amoY Ye mr hr v
A Javh (onstuc Com c o accept one
elass Main
S n lang a
velue
Wcostrchy accejling ciugle
Main CShiny lang)2
langnoqs lang
Langg
Syetes- out.p rintln(langangeo nyammirg
t
r o Vamannin Xanga
o po
Pyan frogva mmi9 Xaug
CProgrenenting lang
uoge
Dtalt velu
er pu
Lfalse
loerute tis
and Spey Kep
a ifforences
ho de access neHods
ue t
gpeY kay
acce
Pros pare closs
utle t
wlle t iiis
s sseel
Of Cren
clod.
e
o V-
metods
keOrd
keqwovd 11 Java
resestef
vesesvef
e
usd Ce
a
tis
eguwosd C fs
ber. D
os a idti
e 1 OS u e l / telke
Lwe Coun in&tomce
Closr a
evenk Contex
yete vano
ca bt usel 1q
a e mYS
class
clals
nien ela) o 4 vreut
ofCGYYe
aa s A
an4dg me
e
ee paep Cahsfsy Ctor (oll
Con
Con
Os UYgumel
lse ose it
na n
sta Ce
nc e
COm closS
vefuYn
cqye
lo uSed to
Can
clos RR
SHalie nb
UDld GEGC
tna, a o0
Sytem- out. rint In ();
ttt, be 600
yhem. piatn C)
te vdMoin S f n 6 9 I )
puklic
he RR.GEGO
ed pu
emple
clas Paent
Stokic in 6 20
e less Bale extemls Poves
VOol C)
(cupeY.a)
Jystem o t pridIn
stem oud.
.b)
pritl, (stY.b)
neo
13ake (). YYC)
and OuipStrtam
Strea m
nput yeam c LF S t h e
sptY
abshaef Closs
clas3 1 ay byle
p u ream ay inpul r a m
cla3ses epre celauj
claas all
Usethmethods of DptSfream
Descisoy
Method dota - o ta
te next yle of
y vend ) eads ke at
pud ab ctac stean. i v e tums -
0 Extpton
p
ttvoS CAd l e
esfimale o thu numSey o
iu availalle ) ASetyn ane
pssli
o Exceftion ctre inpo
void close ) thens
IS t e to close e
Ppb
Stream
o Cxception
-
1nput team
Me Hs Descripio
rooc t wita kyE toe
puelic Vd wse (u) ufe a
he Oukpuk
ByeAs Tay Rleaptveam, rbp.b Shesarh ccp-berem
heam QtpubShtany
DkaalpThemBulfevkiHpd iCheam
Styesm
Me nd Ove YN(
m e TUad Ovex londiuy,mettas M eha me SGTme
MMS hae
mug heve me nanMe amc
yatu
afeve Slawt, eS
Pnamic
Stake biling jis beiug we methels
Use oY Ovelling
Y Over loaele4 ne thod3
na tidiug of oveYsiAko
Aone a
me hd 1S e
Duntie
amd finol methods
vol ond fnel meheds ivale
Cawt be dveyYdden
overloaded
shoul e same
tsqumen
s h o u t le Argmen st
ePere stile Jeing inmetha ovesiing
elhed ovexloading
xaple o Nethed Overleadi
inpost java to.
clas Me thalOverlo ndingEx 2
Stalc in add Cita, int b
reuhn at
ctotic ad iut a, t it
Yetu a t
Pubic v i MaiySting a v S )
adod )
t 3 para Metess
mper jaaio. *
class ni ma
"
O mehod obse clasg ")
systey. ou.poinbIg C eak
Aninn!
Clos Doa exte4 ds
Vond eat )
LogdI Mew De
ADimal a l h e A nimal )
. east O
a eatc)
Animal n i a l - veus Dog
derived e l a
Ou-pud
e r t c2 me hod of
Do iseatin
bse class
Ca-C) me ho
ea
derives clars
eat) mefiuod o
Deg eabin
SECTEON-B
se xe cteA
elou
Jave ceplion closes ic et uen
Ikeievacly o
ThYotda L
GxceFlion
vistae)achine
SQLExeepkon ErroY
Class Not
FouadExee ption OtolMeMor
ErveY
Runtme &vception
Aritheti Exception
a fowde r Exeeption
Aambeofmltyterkon
Tndexouto}Bound
Extejlion
KtY OYd Descipton
hey KeyWord t e ?peaty a ock he
JShonle pate ay exleuon coda. L meo
we
(aME UC tyy lock alone. hrylock mus
loe
follawe i t e r ctoh or
fins l9
Careh heCakh block is usd ts havdle ta erception
musE epreceded bm ty lock uidhmeang
we Camt use Cory ock aloue DFamae
bullswe by binally block ater.
SCaRch(AnthmeicExepio e)
shem.Ous. primnLe);
ysten. ot priutln Cvest ot t
Code )
d n n g ffev.
clnonm
Whot w thu doveME belueey
lrivgBuffer
he Striug cla e Haiug Buffer closs IS
Iimmu lable
Mutlle
amd
)Sting ik slow amd (ohSu mes ring 13u ffer i
ttTpoid"
e tuyn t
Yehurh sb.toltnng )
ConcotiHh Striva O,
Syshem.oub printn Time tkey by Concaling
Oudpd
Time bken by (ontaing wit tring 98ms
Time taken byCancading wth rgBuffe: Oms
Time