You are on page 1of 18
Nome ° Sadia . Akten Barina ID % 190310003, ait Cpunse Title Mobile Application & Deve \nprpers Ans, to. the No 64 (a) ange’ Mc eres it __ Seaton Dy teande 3 ¢ ; - : Byteade 1s program ast that has Leen a piled fom, Souttee Gode mito low-level ade designed for @ Sof tivore Intenpreeter. devo is platforem-independent caheree the meaning of platform ~independadt Ye that we Java” abingiled bate’ ods! @an mun om all operacting. systems . Fon all the source Goda td be undenstood ly the Ynachine tevel—larpunge it needs tobe in ana language tndensteoed by machmes. So here @omea the role of oe aarp lon becaure et convents high level lanquoge into a Fommot that 16 anders by the MOR MeS: Thortafore, the arp lore translates the epureo Code ‘mito exooubable eade , wwe evocwtable code roy be 2 sequon- eo of rachme ivetructions Chat con be executod by ePU Alreoetly Mam reasons for Ava is platform ‘m depen. dont is - * Tt is the onggie of laytecock thet wakes it platform ‘mdependent « Thig adde com Wmporteml Seacture. in the Java language teremed a¢ Ppor- talility » fou every 0S seperate Jum ig available which 1s Capible tw rood the - class file on ley tecode, * he loy tecade is sent t Joa Virtual machine Which ~ Mesides in the RAM of any 0 porccting system Henes., Jae is Called ple form m depende- nt language. Ans, to the 9 No- 1¢y) A avitch Statement is asuallly amotte eMcent than a set of nested ifs, Beeause , the egmpiler aompiles (a suiteh Statement » it ‘mspects each of’ the “ease @ons tants and erates ‘Tump table’ tha b He ual) use. for~)Selecting path of exeenHon depending on tthe value’ of the expression - If We need t Select @™m0n9 a lange group of Value 2 Sunteh Stu tem. nk. edt eta enueh Posten than the equs~ valent logic ctoded asiing 0 seqpone of ef. elses. Thot*eahy Sonteh 1S ERIE «| ent usually - Sepe of vaniables 3 Seo pe qeo-fers to the visi bi Why of Vortialbles. That means, which posts of pragram Cain See om use i1. Usually has a global seope .One cefined then every pant of on program Com aeaess a Vontable. eveng vosuable Ey Voniable s¢epe declaned urthin either the setup 0) om draw () Gloval -vatllalie dedaed oukide of setup() ond. drow O- Ans, to the & No -2Ca) Tnbentence + Srhentenes 16 & process of defrimg ao new Glass “based on an etisting elase fy extending itz @ornmon’ data “members and methods « TInbenitene is used to deelane @hayac- terastes of classes inheriting it. tal thoed: giving its Waplemenittion. Tt is, ene ef the most vm portant —@aneapt of, oops. Tt is an Object oriented Property of Jowa , We Gan Ynhenif ot Can use the Propan tres amd ynothods oP “the poment elass to tk ahild alags. Jt erables Code reusability and saves time. ft is the mochanism In Jove by which One clase is @llow to Mhenit the fea turos of Onothen clags. Teas ‘rmpor ton £ process by uthien object ef one clage Cegutree the Properties of mother obdect of class . Thats ody ide %e Need thic, Ans, to the & No-2(b) Prevent Whentenee 07 OY re To. provent inheritence » We have to uSe the Keycoond “final? When creating the Glass , We must declare methods cabth fina) Keg coord for which coe Moguimod to follow the , Same ‘rmplerenta tion thivoug hart all tne cored @lasses. Prevent overuti ding : 6 prevent, 6vereriding — + By woking methd’ fmal im the bese Glass . By making a method State in the base class, ¢ By making 4 method Private in the base ¢lass . Ars, t the 8 No 3@) Constructo Overloading 2_ Gong tructor overloading is'a @ a oF having mom than ovie constructor with different . parameter lists in Such a ooay ep ttha’L each cone treuctn Porforems a ‘different tusk. Usmg object as ponameten 2 Ex $ élass Data § \nt dats 1 & Yat data 2; Glass SetData $ Vaid set Datw (data da, int dismtd), da.dotwa =di> da « Gotat =d2rs » a void gethoto (date da) s 5 System out printin Cdatei + “tdaidotus) System: Out-printin Cats? He. dab 2); ss 5 | j ~Puhe class Juvacpp t Public Stebe Vaid wnin(Strimgl J angg Dok. da = Neco dede 0; Cetdate od nan get Dak() 5 5 se1 Dox Cdo » 56 5100): sd. get dats’ (da); _ Nee Fras, to the G NO. 2b) a A subclass . Gan have ‘ts oan pruvate dats members $6 a subelace can also acs oan Constructor. he eonghw- @tons Of the subalass ean ‘wrtialize only the imgtanes _ variables of subelass, Thu cwwhen a subelass abject is ingtmba- ted the sabelass Objekt must also anh. matically exeeucte one of the eons truetns of the suiponelass, we éalh Superelacs eonstructor the ‘Super’ Keycoord Vs used. Ang, to the 3 No 4 (2) pines rf Dynovni @ method Dispa teh @ Sees oom x Dgnarnic method, dispateh To a mahan)- Sr by which @ call to an overridden method Jo reosolved ab ttuntime. Pattentpenee Parent oO; Qhild e =New child Os Pont PH newchild YU; x7 epconting Child eRe parent ¢); ™ Gorm pat ble type. This 18 how Java implements rent ¢ polymornphi sn - Chen Oovenntidden method ic Ca\\ed by a reetferne Java delermines ‘the Version pf that method. -fo exoeule based on the type of object it rofer to pings to the G-No. 4(b) In Tova, Stee Keycoored ig main IW ceged Be’ Beilond?) Manogeménbe Hindi ibe ‘ies 4 e with’ vosbables, Methods, blocks and nested alosses » It also used. fon’ .a , eonstan bE variable Of Qrnethod that ig same for every Inetanco ofa class. TF) a metrod declaw d as ‘stabe then the Restrictions ane — © the static rnethad cannot use Non- Static data Member On Myvoke ron sbtic method dreecty ; = The thas and Sup an Comnat be used im Stecti ec contexts tha static method ean Lecegs owly gee type data © Tho t& no need to ovale in ebyenk of the an” 4o° inwke the Satic vnethd © A Stehe vetted emt be oventd- den ‘ma Subelase “Ans, to the G No - 5Ca) SSS The ral Keycoond ‘In java \¢ used to rastriat the uasere and Gan be used sn many, Context . « It can be applied with variables, © HH ton be Wrtali zed in the eons. true ton only. Cagle Progen Gf to undonstond Yoong, Swap \e C Oloss Vonarg Evowple 4 . Pulbhe “int- sumNumbar (int. 0795) § syster out print In [arguement vength ° tongs. length ) 5 Int sum =o , for Cint x. ongs) § Sum += % 5 5 reotunn Suyn + 5 Public aectie void mo'm "Cerny CJ ongs) Vostong Everaple OL > New Vonag Example ‘int Sum 2 = ex. SamNuynber (2,4); System Out. printin (*cum2=" +sum2); inl Sum. 2 &. SamNumber 9,5 )3 system. oul, pemtin (Sum 3 =" + dwn)! y Ans, to the G.NO 15 Situa tow to use ‘this' Keycoond 17 0 Progym step 1 t aa Write the e@ode-wty Codebl ocks. elase Aecount } Wnt a; mt loi pullic void Setdat (mt as mt b) $ ara; be b; 5 public void shoadata () ? System . out promt Iy (“ Valea of ARa’+ 4); gystern oot - PremtTn Cvalut of B="4y): ea iniesr i? a) y 5 public static void main (String ongslq) Recount obj = ned Account C3 oby + Setdata (2.3) 5 obj » Shoes Datu O 3 Step © = Save the code, exmp le & Run, Step Bs value of &2& b is Shown a 0. To’ epreuct emon oPPend line G RF with “this! keg rooad. thig.a = a3 this. b= be sept Save, @ompile, & Rum the ede “This time Ye valuts of A Kb om set by 24% aspactnely , Ang, to the 8 No «6 (b) Methad dverrtalding : Declaxing a method in subalass cshich in parent elass ts 15 ~almaady Present overrci ding _ Known as mmetho a Overridden methods s A 4 teeteee Goo only be eri tten tm Same @lass, tn Subelass wot e The ongunent Vist should be exactly the Same OS that of the pvatttidden methed © The return type shoutd be the Game on Subtype. © The aecess level. earnot be vane reas ttetive than the overriiden _Methods's aceass val . * Bp method declarod final cann't be gvounidden. » Conctructor @amt be oventiiddn

You might also like