0% found this document useful (0 votes)
30 views16 pages

JavaQbank V2

test your knowledge

Uploaded by

Game King
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)
30 views16 pages

JavaQbank V2

test your knowledge

Uploaded by

Game King
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
You are on page 1/ 16
ay x XN a Pinas de pit “ yona_i5 blue pvittt tov cYeating She attyibutes and ject of class will have | ii Objet = A ject bc class. 4) It is_vunlime enhty and yepyesents_a veal ___~ cox en bly. : ~ i) Public ee = 4 peg nto : a} H public int vowioble } s oe | x | it) Prvole i a Synte i pate int veniables 4 —__+—_| ee eo “s Bw Gatbage colle+ion in jova automa ical f | _—_—_}-— Memory by dealloc Hos chiects tha} ave no eo longev le ori vent x L —>—_| leaks . 4 | Ea eit only Selects abject created using nee 5 | keussord © i p otA( | Tn sTava public Static void mains i: entyy pain -cxecubon of Tava =e atin apeili had ln cine =" nhime Grymepment sy 2 ain_m accessWle bya ny othe! \ foe . or Wed — duro ty no + dei1 seman: is name of method « Suvi looks fer at start of exccution of progtam. FE es ct ttbvnaeratlienconeseon Wis mebhed ry 1S_callection ot element of same wo An. Java. — ei ener n name is | ied yper t ede if 4 10 J terete) 1.lengthC),—> +uyns langth + _—___ | er ee area add {jans 2 sung —__ $2), ——> Campavess ‘ | wisi nae oe position) | 3) chav BtC)« ae 4 | sumba « : | x = in ee ee | set Cher pt 0): Seecege es = 4 Niercaninge ee = eekChovet Gn index, chax ch) Se des 8 i| Links ee I Featuies of Java Fee roe [ee = aa ates fe +—— t Combination of ditfevent types of objec cts eee al | eho incevpsrate both deta and behaviour Yun on any 9 aovm Idevic Java vivtual Machine (Iv) a CCUNe _Chvi vonment thyouth | paavides | Nie byte Cole viGcation and I valousk _memovy menagement Systemee eels Ls J64, Special ty pe of method that is used fa __iwitialize +he hie ct + mvolved ak time of obje(t creaton. [+ Th constructs values je. provides deta low i the object thet is why ibis known as const Yuctor | sever Class has cnstvuctey | | eCon stvucte deesnt have yetuv py typo | btn A “Dav ley | f xNuctoy | | fov _closs. 4 Males — het — oosbeaoten constyurtot will be Wvoked. _ | stseowtdAleaue TE teit | forme terised # | Default | : ~ Doesnt Yove any parameters + j= Tin case no constr yok 16 de bingd i l Joye Con stvuttoy -autemyhcolly y.-Jenevates _ ed Fi :4 3 : : j anise cnshates Ls ae Ya XS Yguments | _ objects la vaxdbole |, ean v4 eq: F. “class Re tangle _- ss { int length, breadth; he! Rectonale (int ten, int bye) { length = len; breadth = bre: q 4 i i 1 (loss leDem =n pee ea “i sty c 2 et tangle (20,10 : a s"erelength J; i on em out: pyin ~~_system-out-priniin (" breadth." dul, breodth)3_ * hy at :inal keyword in_inhevitonce: ushon apphed +s Q prevents it fam being inherited. T4 ensures _ [thet the class cnnot bed gitonded H pe eee ata 1 samithve Sot sn Teva, ant. (4 bytes set . saat a: 5 bic Static = Voie enn. ae ce ie \pigelooy ite) da(*Fater number: "); numese = SC.nextInt(), Sout Sarees" “+(num*num)) ile (um |= 0 blic_class, _opn{ Hic shatic veil main (Shin anner Scan BC = Nev x Sout( Soe no} iat _pum = Tn |_| f =ell Pea Hla H re peiset oi a oun eg) “ebel SeFoi cot cyt aySke 2 Sot("Primal 19 eating"); Dog extends picmart Nad bark { O | | Swut (Deg 15 barking), ES j lic cla: inheritance 1 republic stetic void main (string C3 ays) tas be my Dog bark, i ile | | multilevel - when a class inherits fegtuves at a 4 called _mulkileve\_inhewitante —— Pat aw adereublic static _yoid main Stving ca —o We = new GBulld: og) ep err nee enDa ceeerpm eet teed chil Se mle eat ees ereak)C4. —public class Cond t public static eid main(stn Joveae Int pum =to Aying _vesult= Chum 1.2236)? "Even" 3 toda": tiey res uit) >_ 4 hove multiple Vel edt He ceake nee ee _differert+ parameters. Tp enhances code secdabitey Vovides x allowine eevee ae we form difevent ie an input — parame tev: ous en: " = prniceclass felch bse 2) syib rnd mee Sg 14 | publ vid add (nt a, nt b) aes | SGP. aes 2 "¥(arb)). 3 "Contatenahan of 2 Skying: (ore aye Pee sate word ynein (stving 2 ovgs) — ‘4 : { Oo4- 9,26 oe = feet "He loY ese ee 4 is eymethods mus Same name & poxome ity imethod have Same na but different parameters Gy Number of parameters [iyitrs compile-time ul + 1S Yuntmre +P mene phisin poly mov phism fe Y iii) VeGuiyes inheritGrr

You might also like