0% found this document useful (0 votes)
48 views20 pages

Module 1

Uploaded by

Singapore trip
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)
48 views20 pages

Module 1

Uploaded by

Singapore trip
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/ 20
Disus whe bakadypus uln fone Noes vt 0. 4 Ditfenond sizer ard values “lwo hat Higpes san seh ond alt Classes Pita data othe wees pai New powristaie data Hype eae ; "hy one 8B Apps of Petite dake. types — Bowlean data ~~ bute (¢ bce) = char Lb bi+) > Shark C 1- 67+) > unk (32-bit) > dong (64 - bile > Pont > bribe bo Boolean Boolean data toe Uiformaditn tithus diuse 0A Ladue o: a Meprusent the rsp Cee ae a and Boolean algeB re. of fic Supntare bs oodtan boolean vars, Size: Vuibual + Machine Values: Bootran nae Difaudt Vodice: tay,, on false | Bg Class Grmor 4 public &tette vol mak ( &hing args C1) booktan a = falae» bookean b « frucs oP Che = fruey 2 Syston oct * pouivk An. OC" ME Cdeg 5 % 4 (ase Potes 4 , System ou Point ln Hetlows Grek 5 ptm He Greeg Helms Creek - te: “ he hi dade diype ob an 9 bok Atgrad. | sont lie Fleet intige. “Diy dake eppe. s # fo coon mene. 4 Ayko: "3 Td ON donge comaig Leap dpheVocr| Sixes bgt Cebit» Vakidein 120t tay Pehault Value to Eq: : . an Cre br Public 8tatiz vetd maz c u adn (String ay LT) bute a=z(265 Basten. at met tine Sefton ub « pouind Am Co) s attr, Seystinn. out: prairt Wr Ca) > att, Syste sbuk: pruridr (o)> Bi 3 ~ (2b 27 (28 -12T Short - ; The Ahort_dae type 4a to—btt Aigmeal tio tronplamnk witeg ev. faividnaly ae byte use Ahvat th have mamosg ie Jorge Praag larrary) dw Hinalions wahine the, nwmnosy soming Ottnalles rattler, Sgndax + ’ en Short Var: Size: & byte (Ib bik) Values !- - 32,168 t 32-164 (Aclusive) Default value 10 eae 32-bit Hanes. dioga forapuement uintgey Sgro: nat ON Gt cevecr, Size» byte (a2 bite) Values! 21H 483, Che, fo 2, UT, 18 3, Cat C urelusive Defeutt Velue +0 5 dow ' | hare of dng atte dg The bong dake Hype ha by bik dso’ Uap lamants wipes and ts wala for those Ocenrsan wire on unt type ts nok dange enougte by Sold tthe dinsizd Volar Santa t bong eng Ver 4,223, vokus + 1 -97223-312,086, B54, 115, goat (4, At2,036, 85H 115, 801% (Rolurive) | tk 9 Hob : The defauld value iso 6. | Plot : “the Plant dake type bh a Ainge - -prucintn 92-bit Tete Hektg opaht Use a Moat ( ths teaol of ee ee | | 4 Ponting — pout Numbers Syntay: foot oat var; “ Size: Ahyte (32 bet) Voli + ple destmar obegite Defalt value ts 0.0% Far ax bE Gr i Pucbtic Stedth vail ran ¢ Sat arta) UDestocrig anol ast Size: B byte (lo bite) : Vale: “\wd000 (0) t Sn FFst? (65535) Egy : clays GE Or public Stabi Vat main (Shing angst I> i 1a i Chay a 26% ut 4 284, byte bea, Short S$ =56, doubk A= H-355K5; float fe 413933; 12 [2laty Suetim + ok « pruitle C"ohoy 2" 40)5 Systm . 6ak « powit dn ( wittager + vei), Sacto soak ute (iby ab), Syptinn «gut, s zs : Syttinn - os Prunkdn ( See +83 pountde © “flak: “449, 8 rarer ea UY deubde 2 hry vation - out prt UW Hong 5 95 out put: Char : C1 unrkeger 184 bupte : 4 Short +56 foak + h-1333 double + 435545 ong ttaal Nen pokerituve Dato Type or fufonee Dake Tigpe ! a. tring > Strut one defined os am wrong oh Sherartine > The lifes Se ees oe Ahrhing ote gare tx Mak Hh ahving bs Apart a Uialh 2 Aespusnce of Characters uh a Ane asitable Wharear, & Chanactin annay is tlurtier of Aaipanats char Aype entities. Syntax : : 28 tring — Type? Z8toing —vartable 7 =" Serynenee — Eq: 5 Shing S< * Creeks for Greeks“ String roe} new sbring C" Greens for Greeks“) B- Clary: Aces baw - hfuied blue prink oy > Mockifurs A class “que bi piliie fedoras Aefautt acces. t > Clays Name : The Mame Ahowtal bein wth, an initiot Authr ¢ enpitadized by lomtention - > fuperclags > the name 4 fra tlagds Parent (a Super Class}, 4 any. Prtcecateat why A: & ) erntinds. A clans Can aaty extined (Sub olers oe Parent = hheta 2 A lemma depmnaticl ltl Wintec autirlumentat by the oles ony. Prcttert By othe Rupwanal ulmpleminty 2 GK Gn wmplamort more tan ere tirbirte ~ Begs The clans broly fe serrenurcist by beers $3 c Object = A basic lintk of obgeet - errtntiol Prpamoeig Bor eh k lonnich ef: a sete \ F > Behavior | ‘ = Bidar, | 2D. Teido: | neat renee a matte a Et pata esis Ae Bethogl z 5 Prnwde bolis fox au Frclinis spetyt le cceeueteae ace rfate » Then the olaxs | ortrast . OS Mat be derlareal E. Arrvass » > Te ova, all > The Miiek Bigs Eee allocatigl Obert San “ape os s && OT Ripe kaon the A” pesperctan, ercoup Lge? chteyace a... Desvthe tor dep with an smample - 7 Jawa for doop ts used te vin a block of Coole for a Guat numbur of Aimee. Sepbaree : for Curthial Enpoursion, Lest Exposure 7 update E mprursien) 1 badey of the dep 3 = Dial Expresiien wrihializes anol Car’ dukared Vartabtes ond eapeuitel only one 2 london. is wevolinaticl: if the Omoliticn fe tru - He boodliy athe far deep Hh Seutik eo] ihe update Emp updatis the Value of he Coneltinm Us emp valued agatin Uh prourre F7 Deeplag numbers rom ite 5 Class main i Pebdic Stati votol macn ( &tring args 3) 2 a 4 foe doe Cue Fel thems He eth) 7 5 Ye x Systinn ou - pruirtln Cf). Eoplanation:- Ve She og. | Ahp-1 > Yortable bel ne & “ conalitinn Fes, : 4 i 4 Reread © > bpm ik bl and Vt weve : ee ie He bendichen te, Alig 2 Vartable 422.25 a \ a : +B leveanaeile 2 bTrun Bu povintiel 1 wer Mip-3 Variable #-8,n=5 Hh Onshidion tee, True 8 paubtiol 1 de creanet eH Shp ys Vantakte Feared the Condlitin tea, iTme At pouxtia ts therentel & 5 Shp 5. Vextahte 1e5.ne5 Phe londiten fee, * Tras 5 te purl 1 is thereeed hb Shp 6 Vartahe 26. neg The londiiin i. Fret The dnp vis dismefratict E - y RPlecn Lhe ttferent Lisp of epemtens mat th Examples *Pradins an ithe tonsbrack wahtoke Cx Mavi pulates the Value of hh optands Comsiclon The oe, Cnpsusmin 243 =5° Darcl Bare Sfurands ond 4 in Mad epoviter . Youre. OAT the 2 Corr i‘ Plewaiig ype of eperatine « Mi tmtic oparatar : Atibmetie oprrater wun uted te Peforun mathernadiont Cfrakiins duke adolitinn , subtraction ext: £4 Public clam Aritimetic operate rs i Public state Void main ( String angst) i wit Aste: tnt b<20; Septine «outb- Pout Le (any, Sieben «out Pruitle (at; Systm + ott» Pruitdn Ca * bys 846 finn out, Puntdn Ca yb). Syston «fue: Pruitle (a xb): 3 30 che oo ° 10 Matqneent Operator i An Autgnment opurator isan operator usec te Oran a nw Value fo a Vartoble Tl dewe. operators Public Stake vote mace (She 3) Baty a ink a =l0; i cut be a0: ne es Sy6linm « out, print C2005 Systm - ub, pruitdn ( broads Seti + bub. piuntdn (ba) > Selim . puke purtln (bf =a); System . out» prot An silts System suk prwik dn CP O= x 3 oukput © lo 30 20 2ve 2 ° Logi cat operation » es | These tor, are rect to eri Ean [anol Hlegcok oF “epinatinn hee @ pestle Hogidnn te | AND gate ancl ‘op gate ub oligetat electronics - | lonlitional operatans are | ~ EE bozical AND: sition Aone When both i Conditions ou Arne ll bogtcak op: sotionn dime 4 at east one londitinn is tue | > |, Logical Not: sutwur dhe whine a Crrlt les | te alee anol ues: Waren | Relational operations : Rhett *Ranatot ant tttcl de cheek for sulatiehe At pe pe AHORA han end date than . Shee vetuur igre a public clus gure operodsra if Public Stati vatol main (ring avant.) iw GA azo; ne bea: Seystinn owk- putt leas 2693 Suyptinr.ouk- pruitdnl a! +b); Systm» out « pouide dn Carb) y Syction ouk prurk te (a>=b); Buyin out Prunt ln Carb); Syston + orbs prude Ca2=b) a; , Cunt put: False True Fada False True True - ae Class Jawa opunatens ifahe Sabon ais CBting args 15) Wik aslo; Selim - gut . Punta (az 10-2 022093 Aylin, gut. Pundda CAzt0 Hacze): Ayptinn owe” Prwit nll n2i0 4 a£20)); a 4 bubpauk falas Troe Truk, Unanay parade core da ere Madr atte % A Wporand onl ane Weed da deoumunt a Malar deerement On pie ee acs Vale Destetp ta, Ee at > Uoement the velur by | ee ruce Thane ik post thevement ea and pre - Orbument SPrrators o deovemert uvale byl gg There ce post decrement and pre decrement operator ! trert a boolean Eq: F class Jawa. operatey 3 Public Stake vaid. main (6hing args C3) 4 wk azto; boolean b= true, Sqatinn. cut: pruntin tare)? Syslom . put. powitdn C+ +a); Syston « bek- pruitln Ca-—y; Systime. oak. Pruik dn C-~a); Syston bak. pousit dm ci py: outpuk :- lo In In to joe Bik wake toy :. | operater = | BLE wiee oper atin liveth; Manwinwet bk. ho é [Grnpurtions, ruben one sepousoiied ualbh Se BIG, Sores of Zews and ones. | 0 peroter Des tription £4 x» Yeti bib n oe) bu Bit and cee OF orp | q vuWhous 0p y Cor) unpet p of aib Crop). eebane xoR A 4 he pak Valizes Complement) rin The we | | | , | one’ Cemplument | CU beke rey, ) | Eq | Public clive Jove perater § | | i public Static vol main (E&l>ing axgst 3) q. nt O= 5B: | vit be 13: | Systm « Oue - Pourtln Ca eb); | wee Sk Psunkdn (oo 1b)> | tem out. pruntde Carbs Syption. Buk poubtdn (ome eva); Ly Oubpuk.. | 8 $3 as 54 Nevin Sfronatioas : operakor Anat whe Aeoony sporotiny 6 we tmobtsiiner! onan Aeovemsea Ube aluagtte of Coke. Ovi Coounwrusy We cnol Conebisbvnads St yrulay Utoncetitnr? Celetuwend 1) 4 ee + Conditanes abt whe erprociin er WRG Nehiouns a boatean Value > Slutinwent 1: ult Te the dbatument be be ereeutiol TA tonctitiie auuube ude ot Hue Stoke tid, ~ Slaiment ot Ub Os ihe Abatement te be enews the Gnoliticy serait wh a folae state Bq clas ava operators { 3 a P 5 public steric vote resin string anys 03) 3 : Ur a+ 20 bzlo,ce30, ress Te = Cark)y (are)? are: Cbred7 bred; Spot out: pruiitdn (® Max of stows runvber 5 5 output : Max of three Mumben = 36 Shep Speraters : Shift operates One Used ch AE tha bik of Number pt on, PG Ao ay Multi plipeig Da diitcetg dhe number. Thine ar), three fe D ol ered Hate operehorl 777) Symtax : number Mult — op number — ot Place te ~ shyt, Eq: u Peblic claws favo. operators Pullic State vatd main (string ary) i nk abe, Seystinn - gk Prurkdn Caren); Byler * out: Pik bes aleay, Sypihinn © Cub. Pruink Le Ca r772)3 Bs 3 ouput + V3y My 4 Dizon the edwumuntaton arc ducumintatiin ce Jove > Cutisement Crt)! The Urrementadtion opuraiby Las ont operat Cahicn ts Used de urvuase the value of a Vatable bug | on which Ut is appli Tuco Appes > poe rbument (++) > pork tintvumenk Cx ++) Pee ek omenk opemter, : Jf an dhoument operator bs used te front ee em arn eee cl cM ere eo penne) Operates Ragen oarnint Synkax + +h xt which theremin ste el ae by) Hx" Vantable » OC — Ege Class pre Trevernent t Public Statl voicl main ( S4ving 274603) Deuerere tan Wb Y= tx: Sietine ou prctte (Py Value 4) 3 3 oukpuc : Y Volue te sy Pest UR tement operator: FF On Grtimink operate is urel after an SPerancl . cbhen & Collect Port Unoument operator . Syetbar s Xtr! Which uboudse the value by 1 of Varta, ae x qs Class Pott Untremernt i Public Static vard mast Sting ovat 3) wnt ¥ = 10; Ut Y= xtes Sys thom «ork: pout bn ( “SY Value Be euys et — Value 210 Devrement operatey (~-): The deevernent bperater ts an epevatoy which ts sed ts decreace fhe valus of the Variable bal ow which ub applied TYP! pre cluerement (--x) post decrement fx~--) Prercleerement * Tf o cleevernent operatey Uradk ci font of On Sperand- dren ik t Called pre dicvement operate Serta x ~ x which heveare Har Valu by | of Varia bl © oe £4: Clase pr deerement Papues Btabi void main (tring angel 3) Chet x =los Wb Ys = oxy pe en Yt cies ey): % de: G Velue ig post Decrement opoatoy + Tf ehecrement operater is Useol after an operana- hen cb fe caltech port deeremenk operatey Syntax: xo hich decvente ther valud byt of Vantable “x =O” cons’ port decrement i be State Vato main C String axgsl3) hk X clos ee Sefstinn 6urt - Powrk ln CNg Value is: “ry)s i 5) value it lo- en | 5 Deserthe clue x = tae: deatstiev with Framp le. TE i teed ob decide aminag Multiple om Thr § abubmanis eu. anenstit pore Be ATclnm, As dren as ene af the tonditone tervtrelleng the Y Ts Rue dle afatiment arsotiatiol uattir that 4 | CXeerticl ancl he sect ef the foster os hy Poca Ef e hone of the Condititns is Bue - thew the font olae statimenrt tattt be exeewticl | Syntax? i Ceonctifeen) Strtiment > eee tL C Condition) | Statiment 23 Ae Atakirnent 5 Eq: Class erect State yeid mar ( Stag args 3) ut Tz20; 4 (iz 10) Systinn. owt pratt Tis pone | ee Y Cis zis) Syst .ovet- Préntle ("2 i is tn", Cae 4 (i ==20) Sys tim. out Preattn C'T ie aoe D3 ds | Systim out -Prentin "4 & wot frvsent tn), Systimm ouk+ proitin (" ouk Mole Uf - lee if mi 3 0. ak 1 & 20 out Atle 4 -elee if Explanation : 1 a 3 A- s 5 SN tudntde YU lane 1 Gittalizedte 20. Condithon | is Cheekest » Qo = =e, Yul Falee. Condition 2 fe cheekest Gonoitwn 3 is Cheekeh. 20 = = 20,1), 0 “i ts 20 “dete pounted.

You might also like