0% found this document useful (0 votes)
2 views15 pages

Java Assignment2

About java contains important questions and answers based on vtu

Uploaded by

soumya060504
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)
2 views15 pages

Java Assignment2

About java contains important questions and answers based on vtu

Uploaded by

soumya060504
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
contact _détines aseh_ gq -metheds tna a _class fast pes as id to prvich the ns | bod ie a Ly €, ilay Ss <——Hd_Aa wtevtace ts db A m i 4 = tion 7 : Abshachoa: Hides the wotrtoa\ details g hoa a tehavirr_ is _per-fevened," Focusiag oly “oa ushat ne behavior is ‘i> Loose Coupling. Allows systems ty datey —Allowas _syskeans_ ty ntrvact Wa ceadand _ pee allt Coctiacts vote Ynod Concrete classes erating the code ee ee Md Poly marphism: Faables dbiect: from completely differnt arene [pen iam mings OY Sy |) Hu ttigle tohertbaaces Provides na fora-dats || apt belo vias ond types —focn_mulhvle urces. com : “Ubbane ously ms eo se ee Tenple Mentabian in Jove. = To_mplenent an _inter-toce a clase jae oan een — “USES the ermplements d——The_Class crush provide concrete ample | eee Ne =satkators —ta_every_onttod * defined my sae hla a ET | muttiple lotheritance with lartertacex, ft on ees ia ar hi entonce. | ions jaa io * 5 ~|L iates face Add | m3 _add (int a mt 63}: micitace sub ¢ ms sub’ Cmt a mt bs _|dass cal_ienpleoncats Add sub @ ic + nt bye, : | retutTO atl: } public mt sub C into tm b) Tetun ab) 7 bY class ofa 2 7 public static. Vaclbacta (shag rags ¥ -| clas ) Cal _x = meas catty; QP UT Action: 3 f subshachen : 1 Lo defeats | Gcvos, sles Abswact dass ta eins tach i : . ig if alk while shoving reloaded asses. an not mn to a puCLaCy ee . thotk + hated hide. t+ahoo comma Cade. ond Styuchne tere are Me top Five dutfenctes blu on onkidace ond lotexfage » Reature, | Avstyad_ Class if [laberton | A class amo A_class (ao_fnaple #axtead only one. =onent _mudtiple ‘ HeHands. both __| Pramayily contans ——_/ . a cle cantando atstnet_ etna Instone vaviobley Hot con loc enatited cshucoy, toa have onsttuc | Canno} — bos fur tnitalizatig | . Access Heonber —C00_hawe_| a 22 Explain ne creation 4) package ackag ng = ast peng gag 2 wa package's 0 dommspate oi _cordaioen eecanico_atd fy gvoup_u_se_ng_telattd ond modules togetca Creabya g Packae Skp1: Declare Hw pacleage ond Crease thas class ________ Creede o_0n0 ple named Garin joven package dectorraan. © js dlavak must_be ne a a pac Class Basic Hath * . Public mt add Cant a _ont de retym _atb! 2: Sthyp tae Fledes __struchne Project = Flodea! L— catersatsr / LH Bic Math yavo + 2 3+ Comple Hu paiticerge Class | Se : Open you +mmnal mnside Her project = Hlodery ore run Yre_com — et = 0 Ue Javad =d. Calcutoto / @usveMote pom closs else wher» Create o file. normed project = flodear use ampat Pilorbn Comm ord To_wse_ yoy _puceage TestAPP. 30VOr— inside your yot d mpa + _calculasnsy @asi Math; i public class ‘Test pP. g : ia \3 Padlic Aaghic void main Rosictath matt = abo posi cMatn (2% add (10,92 my yeyulk = math seal 4 | ry + he > ; oe skp Ss. RUN: Ye _hnod_-Applicahre - | compite ona rua 4 onan _eabry file. fimen_ysurt_teneninad _— . _yavac TestApp. java ____ r text App | ourpur The sum oI. 80 tea epi pg ea ph ta Tae | 9: program Aag_|| Exscet 1 fa_exceptboo ison unexpected or _caomalous __—— i: Leveat thet occurs dui 9 a7 fe omcl_dishupts Hs mstruch a “>, a ype gq Eacpin S D Excepboo. Tag A checked exception 1 ee Pee s51_exception ___ — ai — -- a ; D Unchecked # ceptions. i Dp [an_vnchecked y catch {ar [Link] €9 LoL tated Rye“ —— 2 cate (Ayano Excep0 £1 ¥ caich( Exception ¢ . Cs ir. 5 us am E 4 =f I ourPUt:. csnaot divids by 2670 83) buil=M_exceprins _ . . A ee , Fe Ble pe Ne i or Mae nam xcep tag 198 +— Steps—to_creake _o_ Castes @xcep99 Step 2 s_Crente._a cass Ynat_extnds Exccephiag __________ Class Tovalidexcephion’ Qxteads Excepbbo Sep Coenle 0 comtyudon Ond pan. ne eeroe message | Ye _pomat class uusiog supe) pepe Uneaten Super Cone ssage J Sepa _._ vse een Saar ene Ce Ard neo nc acta ope 8°, ay dep 4 Hom te Pours Procnem Custom Excephog ear ae Begala ee ee 1 joa Ceci opie Cd Super ce 39,15 : ablic class Te a —— Sop = ~ Th Ss Syate void check pat rs ee. vg acaar e) ths ton taunt tee Su = ‘Explain Multithres Pmgramming —usitta compe -| attending the pace Qtxeuuting—hwo_or dan Ais | i Se see te Mult Hareading qbtoud _____xmukkaneausly With pm | smaller —onit_g ante | eatipe tas _ron_tontrrnly impmnicg C00 Ustizabvo ond. Applicaton Per feronence Saree eee x __ || clas ~ _putlic wid run O2 : ee ee aia Cs y public static \ = new Nyinead 0% t. stort 03 } output: Thread. tr runing Explanation __|| class Mytnc_pause “fhe exleation 9 He _Cucrrend iL Sorad fd speaied jad dy time =i oO 1 [=' IS a Satie mefinad § fhe tread clay syatox: Thread. sleep { milli gecoads)) —_—________ 2) unit O wait) metrod ig usd to pause We Current sYoread wos | _ Unread hotties “it _belo +n _ object Coy Sytor. object. Loait O35 2 =the Jime Loa one a belong to Hu Object Clon | symax: olgect notify QC): [ Bon at ie U Kes oa i on Ye same object | ot delorgs to Hu Obyet Clay —\4 wwohen, ek Yn aye Guilt) yawn

You might also like