0% found this document useful (0 votes)
7 views11 pages

Writeup 2

Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg bghggghhgyvgygfhh

Uploaded by

Mada Mahatma
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
0% found this document useful (0 votes)
7 views11 pages

Writeup 2

Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg Hiihcchfgggggggggg bghggghhgyvgygfhh

Uploaded by

Mada Mahatma
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
wrer'te uP -GT) ae Esse sil Exception PF > — | Recovering From evzos is| > ion can be recover? | Not Fossible- ee by Using the toy-cakch = | block 23 i ~~ font = —~ 2 | AlLewsovs injava ave a rt Can be categozizecl Junchecked into 2 Categozies 1-€ oo | checked ¢ Unchecked 2 I ~ = 3 [rt occuss at sun time. | a EE OccUSS Gt Compile time os suntime. —~ 4) |rt belongs toJava -lang- Tie 7 4 It belongs to J ava-tang- . || Estow Package. + Exception package. 5) || Ewvoss will Not be known s) only checked exceetions to the compiles - Ore Known to the compiler. tig mostly caused by 6) Ft is Mainly Caused by the envionment in hich the Gerli cation is running = lang -StackOVerF low) , pce? lang. oletof Memoryenor. the applicction itsert 1) checked Excertions= SOL Exception, 5° Exception. Exception, Avithmatic Exception Classification of ExcertiOns - Exceptions . Bilan Excepitorn eee ime} ‘User - Defined Excertion £ eS checked Exception. | Luncheckecl exception j Tbelacsnstfourdxception = Aviv hmalicexception Inter sueted xcept ion ~Tdjasscastécertion Exception LANUITPOl nte-w Exception Enstantiationexcertion b+ prmaysstoseR the PeoStammes Showid have to hadle the exception. % 9. FilernputstveamC )> File Not found Exception’) » . zo Exeeption . Pog oa wed — Ve err erly paew anchor Wi 9 ey iran Finan her Ve TOAPR pp ay te, shen PIV See baad dasa, Swing — Sittesontiasiate throw > vs thTowS with example. ce ortow Taava Lhroosreqord —| ~ used in Mm Ehod a) tacos Keyoosd can ed to ProPagate =~ | | | + qe hrc kewword |S Follewe | | 3] the thzOws Keyword =| Ts Followed bY Class ; buan insxonce of Exception names af exceptlons to be thrown 12 be thtown.- ape ave ou @ thsows is USed with «| thew is Used oi thin the the method signatuen - | mmethed - We atedliowed © thoe 5s) We can declave mattire exceptions Using throws Kegeosd that can be Etrscmn 69 Che chron. by the method only’ ere exception at a camele Public Class perp | Public stakic void Check Te crum<)) it | thoow NEw Avithmaic ] exception ("Number is T © Examele SS T jmport Java. 10-TOExcertigns ~~ “class Test § Void MO throws £0 Excepig = = | throw ne@ TOEXcertion 1 negative”) Cd wice ese); | ee § Y || else { “ void nO) throws TO Exceptint | Suyermvouk- PAINT A MO) 5 oa i €squere. oF 7+ num+ t imc | vie” + Cnum* NUM); | void POF di aon =e yo nO>s a i PUblIC SLAEIC void main ( stting (J args ) Cakch (Exception €) {L bemo d =new pemot); L sustemouk. print Cecelia a. check (-s) 5 4 handled"); 4 $ any | PUbIC static Void main (sony ~axt6}- { rest t snewTest(); ~ PCs Y 2) [list the exception hand lingnin java: with syntoxe. ed ea... : — ~ mechanism — — | rn Java exception Can be hanclled using 5 Keywords — la tey 0) catch 3) Finally 4) theow 5) throws | tey -catch block | the Java code that may Produce an exception 1s Placed within ry blocks SUtable Cakch block €o handle | the exception SY¥Nntax - toy { UY visky Code s . Poem catch: { : W Wandling code © | Finally block | Finally is Che block that 1S aways executed whether exception is handled os not. ©] syntax - sok. toy nN code { it code Catch CException e) ft 4 W code Finally 4 i Finally JI code cae aia ie Oayn Re Qenerrted Sy they Can ha Mane = 7 syntax < ASTOHdea AL Thyeweales Vhsew | 2) TF the innes try Notk has no calch Weck OF Fasc cath bic ab is not GbR to handle URE Ga |__ the next catch blotk of try Statement 1S Inspecied & [hands the exceetion ofinmev ey He [Sy thie PreQaa Continues GINS Ghies one SPER ee rE Biot ~ | || i L catch C &xcertion €2). Neode Catch (Exceetion el) ‘ 1 code | Examele - Class Nested TY { Public static void main Cstaing tI avgs) Re ty a | intalI = {had 49535 SsY¥stem out -Printhh Cats) ); ) toy { li bane x = ale /o- 5 5 catch ( Azidhmatic&xcertion e2)f system-out- pvintin C" pivision by zero isnot Possible") ; 3 Mei a) HL S¥Stem. ouk-PTINEIn C" AvvayTndexo Ut oF Exception"); SUstem. 0 Ut. Pant inC "Element crt such {| ndex cloes Not exists"); J . Se . a A 5]) Define the Following with jes Usage. @) Finally 6) Finalization ¢) Thowable . ee En aes » Finally S |) * The finally Reywoud is usecl to Crectte BOCK OF de> e that follows a Catch block. + Finally block isexe cuted tohether exception is oF not ae i m @ use of Finally block - Pea d Finatly block is Used fox Freeing BESOUTTES 3Cleaning yo Sing connections etc. ——— a) It €xecutes a contsol tvancey statement suchas q = BEtUTN OF AbTeak stcttement : © Finalize 2 + Finalize () is a method of object class iInjava- USe OF Finalize ¢) method- 1) Finalize c> method is Used to Pesfosm eleanuUP activily before destsoying ary object a = | i Fimlization- Before dJestoying any object, the one collector alanys cals Finalize ¢) method to Pesform Clean-ue activities on that obj ect. This process is Known | ~ as finalization . <] Throw able - « The Thsowable class i§ Che sueesclass of EVveny Some tt $ exception in the java Idnguage . = only objeckS that ave instances of this class awe heen by java viztual machine os canbe thoown by java thvow state menk- a I a 6} ENustroke TIo hand ling in java java 5 aqicrasenaate | patastream vs Filestveam VS euffesedstveam. —)|0 t/o handling insava ) Java input $ output is an essiential Concert while | || working on java Proszamming. >) Ft consist of elaments Such as inpuk ,oukeut g stream. ) The ineut is the data thar give to Programs output 1s the cata that @e seceive from Progzam. | Stream sepsesents floo of data S) TO Give inret We USe INPUE Stream F FF oUtPUL we We OutPuk ctseaTy aneusseeam | Java outplisream | Read APRication | weite

You might also like