0 ratings0% found this document useful (0 votes) 28 views16 pagesJava Own Notes 2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
me Enceplen Hesltg
take 2 said. fo be an err
e
> a Programming mis!
Types of Errors o-
© Compete tee errors (Syntexea)
® Runt&re errors C Exceptions >
© Logfeak errors
> Exceptfon means Ren time enor
2 All exceptfons ave Closson tT fora.
2 Gr fexception Harting wo vce the Silorsng repur
a) try
@) Catch
3) threxd
| Cay thyeosa
| cH) fray.
pp te Santen of ty oath eke
ty
a
= { tock code
5 catch C CycophorCtasenlane Obfec the ference +)
7 4 Crrov Message
> cohenever Exceplforn Sccored Fae Programs then
the object of related Clas Exception class crealeg
by Jue ) Pased to Except Handley @(C catch
And Bxceplitn Handler Code Ps executed. 1
@ scanned with OKEN Scannertry bleck most be aseoctaled aoith teas ne
frailty, beck.
Exceptions ‘7 Jaua-
5
catch block on 4
a here axe “hee types of
d Excepltons
cy Checke "
cy unchecked ercep OM
Checked ®xceptioese
ee ception classea that are eee
Ex
° bs Fare caned chected Excopkt
fevo: lang -Exeeptfon class
2 @ cep ox Ss indie b'
2. Loch cked Exc Fond MU f be h Oy
oa vam mer explece tly othey wtse coonpe@ timo erro
Prog li u fo &
occurs + 5 bu
3 checked Excepttom clude Je
Java larg, Resat me Pxcep for
checkg by Qcaich blocks ore
kil of Pxcep Hons .
do nok
Class and CHa Subclasses:
> ate Jere. Comnptler
throws Clavse Jor aes i
2 all appifcatfom spect fe excepttom Ore hories, once
this category =
? Unchecked Excepléona 8
Nee RA
5 the! Gxcepiéon Classen that are derfved from
ffoue- lang. Rookie Pxcep ton class are called
Reptts unchecked Exceptfona,
* Hanelling onchecked ExecephPon » are opkfonat by
Programmer. Reet all unchecked Leceplfone @re handle
3 A
@ scanned with OKEN Scannerey Syst ens tenpléce lly . foo.
> Handle — enchecked Exceplfonay to dfeploy bser. fe
Erioy magn onl ‘ :
compPay doesnot check try and Catch
con throws Weck clavse fo, thee kind of @
2 all goread F & i Ke
> 9 oeral FP xeepdtfoer aye Comen und Ae, mn
Category = ied
othe ue f
Ts Miserly of Freeplfoo! chisey ¢
> the {Java
Obfect
Bp
ote
Neon Cwable
een I:
Exceptfon g
Secretion apy SreneplelBeop
cheered 5
gc’
yee =
| / [7 ae +
rae Nd
(Seder Ost OsBourda Beep fe pete \
i | Yeplon, Grete He Breen Meg va
t Gy ~Cephon
rarer
teal gosta Harb Rana
2c
2
@ scanned with OKEN Scannerie %
Favaslong Boleger
vee oot pacer CoIrtng ) throws NomberPormalexceptien
lie Shatte f "
. Orel for ee ak from atom sieing .
SUt Tg Of
be
class Der s gs Bi
L pen elalte ved matn Ceniag on i
— DTT A
so
a ie -
i: CasqrCo]);
Made Tat Le Sokeger-posse tnt as
Tok se Sintegers parseint- Largs aye i
fot B= Gs /
Systexn cor- prrotio Qe 1) 12 i
I
! o
Feateh C Root exkepteon 7)
Ee Ra
2 Saeier: evr: prfatin C1e foSkringh) 5
} ek —_
(i —
Ge the above Frampe
P called
shrowable class bShéacs
2 o
CN) Gawac Deno favo.
o> Fano. Beno abe “yr ‘
E %
Brcephon T thread «maih* Savas lang: nlomberformat excep a
3 kn the above Crampe Nomberformatl roephton handle >:
Syskern FrnplicPeby keoe CF Ps an onchecked Excoph on.
@ scanned with OKEN Scanneree Oe
class emo
: peblR stake vord matn CEng argelt)
S
“sty
3 Prk x= Gnteger: passeint CaxgnCo)
Tot Yc Inbegor-parse tnt (ag2cu);
fhe % = ys, i
S-o-p Cae
F catch Catrrauyteder Ouro Bounds Excophen aa
: srerP Ge Ply’ Pass “too Argumenta’) »
J
4
Catch Clumber FortnatException ° ne )
ice pes a ».
eae Plz pass teao kage ook"):
Catch CAR Hymelfe Exceplon ae)
5 Sep ("Plz enter Second cxguenant exeeph
i eero')e
on Jexxe Come Pave
A> Sora Como
po Pass tooo BrQoments
\ Cy Tava emo abe xy j
@ scanned with OKEN Scannerply pass tooo tolegars ek
Ci) Fava oemo '0 ©
ple pass gecoad 2tqomenk Except 2010.
city Gave pom 10 5
2
Goecteetebmne > a
constvoctor 8 a
vege Fears" (Stvng) throusa Feo nlor Found Excepl
x
F cponn & {00 Foy read?ng. 24 the fle, Fs edsty
cae ton eorl| be throes
theres
Ase (Ro Not Fourdé xcep
oO
Fo ¥ }
Sport fone (OF,
Class Oemo a
2 pobltc ckatte vod mein Cote faq arg ye
(< aed)?
Pox Neo Ceo Snpor Streo arg ;
FetadngukStreann ffs=
city Favac Oemo
enor: ooveported egcep fou
Ou
Demo: favre 7
£4onlotFoond Exce pion musk he count
© Scanned with OKEN Scannerclass Oemd
x vord cobe Chr 2)
| 2 rt Card th
Syslor cotprintin (a.%at als
youn Negative nlombey xcep
elee
throw nec
’ CString orgal 1)
pout static vosd. man
i 4 PE RE Lnkegar- porseTnk Cares Col);
Demo obz reco Desmoc?
senlaeli bfon (4
ob- cube ous
}
J
Gp the above’ Example Sgstem Fnpl&c ee
ord catch block - dor Nlegatibenlomber Pa
prot
ie cophar
Pa a wnchecked Except on:
_ throw" _Keyvaad 8 — °
> Sk passer the ae objeck of an pce
close -to a catch block. :
4
bi ! ae
@ scanned with OKEN Scanner“threo” Rega wd ¥
AAAS LA
Gy Pe vsed 40 orem an ExcePhin 4 method aad
alre sed 10 handle erception
aso (ane fo handle Prreoplfor
(
and catch lor ka
-) there ave
a “4 vetig ary
a ey using brows Clavse-
ry osieg cry and and catch lacks °
class Demo 2
“pork atante vord matn Csliteg argoC1)
5
2 chy
S
toe ge Integers paraednt Carga Cel) ¢
Demo ob =necd Pemotiy
S- ob cobecn)s
fee atch Crvegantuerlomber€ acepbion ne)
% Sep cners
He
Offa Quy org RE throws clavse 8— auc Derm Jere
Be class Demo tT
peste etal vot main (Shing arg*CJ) thyevor
Ne achive Nomber Excep hon
Lt x= Lotegar- parae fk Cargs Col) §
Demo ob= neco Demt);
4d
@ scanned with OKEN Scanner-}. Molitibreacing “e
' anRweenr"“®™>
S ection of wore than one thvaed ob aly
8 called Molitthyeadtng..
thread - a yeaa piece Of code thay
erecuten TadPpendenFly «
> Brery Pregiam Confatna atleast one thread »
ato tread.
4 Creating @ new thread ~. § raya .
@ By excteedl fang Fave. larg Thread Class -
® ey "mplemeoting Jaa larg: Romablo Taterface ,
Lele cycle ofa Thread coy thread Staton
RO RODD AN
DAK RRR DK
Starkey
“agp
oe
Ges)
sleepy )
destroyey
7 Mew Thread KF born
Conshuctoy, Ps
therever Thread class
Called.
@ scanned with OKEN ScannerFaproad comes 10a cyeady State coheneyor Slartc) 1
bo, called.
Ps :
apiead Comes lb a otenntng Stabe — cohenever Toacs
% calted "
qhread = Comes toa Sleepity state echenever sleepe)
g, cated: sleeping Thread’ wit” bien after tine :
gterve! \ i
slept) takes rofl Psecenda ana payamefer. 9;
‘throad comes 10 & Suspend state cohenenoy aesponde)
% cated:
sospended thaead cwirll “Ton cohenever yesurrec) &
cated ee
Fi 2
shread comes to coat long State Whenever eaatt |
Pe caued- i
yon cohenever nettyes/
teak Fag thread, cell
ty Alles Ps cated,
de echenever
iol
destroys Ps Cated,
Java lang» Rennable
Thread» Com
loath | Method
phot
nottfyc)
mo SYANO | ‘ © stare
eae fl pone 2 Nett bodg
of , me hed
t ’ (Joua: lang: read coat) |
4 : ee yecvmnec) fea
ot Cléepey |
| ce Hh * deshoyeyild /! |
@ scanned with OKEN Scanner“> yone) Pg vsed to wovcte the task code.’
> Staley calla rvoncy Fonple cP Hly .
Joe: lang Raha a Clexeg, CON gave’) 4
Meth) | ny aepetered toy
poslf . fPoal “nate voted notify cy « | a
pobl?c ffnal native vod not tly alles; t q
publ fat vo&d wat Phe) throum Serpe xcopy
Seva. lang « Runnable 2 wy)
Rae
NR
Public abshact yo Yon
PTekda
Porlte Static fina) Tat Han SPRionTy oan.
pobl& Shalfe ffnal far NORM pRoReTy 5 65)!
Posie. Static ftral tht Maxl pair ity: tio)
5
ConShrochra 3 _
EA
poblec Threade):,
‘posite Threod (Romnate) Vinod
Netkoda :
pobl Stati nadie Thread coment Thread () +
5
: +
porim Statfe patie vot Sleep Cleng) throca
a Anterople Except :
Pestt eynchrontaed vod Starters
posite “Uc2t rene) ;
@ scanned with OKEN Scannerbite 8 |
poble FPrag Sunchion?yeq
t
7 vord Seb pl j
publ Pe tinal ‘Stiig JetNasnp¢. om Cty Je |
main thread 4 : 1
Cu defawr Name Ina |
are S ip) only |
2@ad de Savoty Prtorthy 25
; 10
5 PYOGram to Jet Cerrenp thread }
a a a “Female
class Demo
LP sum eG)
Loan
Yead } =
thread, Comentthiead
Sop ce getters)
s
oP St. ger fee
t+. SetNiam ¢ * “demoty « ,
ts sep
PIPES C thread, MAX PR icp
ry).
Sop ¢ } getname)): ms
So-p C t get Préorty ¢1) /
} J
4B
_
°3
@ scanned with OKEN Scanner= 3
coxfiod personel
= 3
Bp usay
(2-1 ¢Bro | Brey awoNPPH EN ad Bt "
—_—s
—3 70 40R3
rf ye
1 expos fo pay? bnyeiudiyouhg
; §
: your eyoys j a ‘
| _o eruoeypuhy
BH, ad) Uray oy re an
(einem * saath
8 payyoaro Ryton uke
sppoo fo WAjq. 2 Beseguoryoviy @
PAH eu 0 Sreseiuorgoub> @
apap gp 282UEDuAS uBio on 4 210 124
soup 0 fv" Poaqi op ‘Bug — parsosah
of Yoraypo. Oy Wsiunpesi 055 45
a
F a jo 3sa000
Naa
\ » —3 vogpre ss ono
@ scanned with OKEN ScanneriG
Cac FF ) ysadep pron pat\uonypuhs
4 4
©
°) grag 2
5
(28 Ugydaorg ) Yor0D
SCpaduay oOpYIE . ) dog
£awoauno = 220709 = axo]04
§
on : byptau (Soyo)
‘Cysodep sop Sry oO) Swopoq $0], ) 4.08
etn §
(quoouso y 82K.) qs
“Tome gy cr! ay Pass Fi PEAYL |, )dos
Thay
tT
S
(aoe {EO}F. JowDspyyior ~ Po" » pakguorgoubs
c 2
+ foa-odas = axwyog tag g
Bpowwoy —ysawaslony YYPY Se
1 Fr Rogge 9 Opn DK IU—P a Bord
eso jo
4)
hoe a4
,
an voed ey
ype guquieD Af -
eh
@ scanned with OKEN Scanner(
Cs
‘ ( foa- 000g) 44:0dep 4,
s
Cua, por opRad
; {
Fa Gaguy z
(4 YOY) 7 soUIYSOD
‘9 yuog.
3.
Poeexye Vpus4x2 Trewajsor S80] 9
4 4
« (foo-o00g) OTOP 109 + G xt
t Ovwor pyran >aigod
4
S49: 51yp z
CG Yeoy DT sdunays0>,
+4 yoy) ¢
POA4L Vp Frr%UqsaD ssv|?
4
= cppoey | / So Reyow' A
£(, payndusas 4asodag , ) dos
‘4 nou + aloe = orwoyog,
sodap OF PHMIS Y pray.) dos 4
@ scanned with OKEN Scanner* Peyndwas CPAP yey
_ Paypdusap 430daq
{dep ay PAYS cpooig
jyodop sag Diy ioon. « OPA S994
LT
CFONPYILD 104 poe] ROY F Poo
; c
i ( AYO 4 t
c
“) Cousayso> may =% CraUays0
/ {49+
* (uausey 50) Mau sl), Prewar0)
"Coyuoy aay sg Yuvy ¢
(wad.
cuiag $= 99¥)O
@ scanned with OKEN Scanner