Docsity

Java Programming pdf, Study notes of Java Programming

Partial preview of the text

Download Java Programming pdf and more Study notes Java Programming in PDF only on Docsity!

— ( a 1) Use. Tava compitex and eclipse platform +e wute a execue java poogram: W pai * Paine Netto Public. class Hello Public stedttc. vold main(String Clargs) user out Prindn (" Hetto wowldi" \" . ) Oust put Hello World! Gi) Addition O4 490 Number Public. St Class Add 2 Public. state void main (String Cy AY gs) 2 inte 10; Int b= go" Inte > ath? System: Out: Prinein(e J: f Oud ped 30 Ae, ~~ Qi) Pane Anthmedte. Opesctor Public. class Anthmette Publica stedle void man (Stang. Uy args) 5 Int-as 10; Int be 30} akc meg System out: Printin (Ath) System: out Print (Ab)? Syste Olt printn (a+ by System: OU Privitln (a/b): System oUt Prt |n Carp)" J { i uct put - 40 -20 300 0 10 7 6) ® W) Paine a leer p Gear Program vutng scanner. impovt Ave. uu. Scanners’ PUbITE Clase Lectp\ cay PUBIC Steele, yor, meuy (String (3 args J 4 Int Yecas SYdHM- OtLt. Printin Enter the Years" J; Samney xn NeW Scanner (Sistem, nN)", ear cy. NRKtINLU} # Mearyipecy 86 Year y.400220 1 Hear 100 20 Kg Year f-ga=o| SPH Out Priaclal You 'g leap i eye § Syste « out. PME ("Youy 1's not Lecip year" Year" J" Enter the Years 2004. Yeay 15 Leap Yeay WI Print abo Palindrome. numbes or nots Public class Palindsome. Public SkecHre. void meuln (Sdving args CI) Me aa 525; We yeversec 20% ink Taman dey M+ Ong tno at While Caleo) Semolndey < =A LO; Palins =~ TRVCWL L1O+ Ye mainder Ara [lo° It Covigine om Teverse J 5 1 themout Paintin ("Num boy |e Pallndsome" elle, 3 ; Syste" Olt. Pant (Number 1's NOL Pallndsome' t ouxput Number 1S Pati'y dyome. a @ tes ‘ hi a 4 (viii) Program to prmnt Quadratic. Equccton. IMPore saver: Ut) Public class Quard vate Equcchion Public. ctech'c. etd maln (string Cl avgsy 3 double. as bi 6, d} Sytem Ob prindiEnder the vole of any) StANNET Tp = ew Scanner O = INU Nek Uple Us Sytem ou Prindin Enger the. youre, of bt ny b = Inpld-next double UI Sgem-oud. prineint Ener the velue of. cry" CHINPUA NeXt Double. Vt d = b¥h-qox ates 1£ Cq> 0-0) (System: ns double x12 C b+ Math Pow (di 0-5) | (WO *a ys doUble. T2-% (Hb Meth: Pow Cds 0+5)) | Ca¥ a), System: Dut Priinetin “The FOO are" { eyelet (dea orn) g F double v1 e-b| (RO¥a)! an OUR PMN ("The wok 1's Tex); RAL : SYsHeM OU -Printin (Pooks are Nol Yeoul")' ata and" 4 yop a Wx) Program +0 prink Primenumber or Nok Public ctass Prime. PUblic Slat vod meth (sining args C3) 4 ink Lyme Os Haq <0; nt ne 35 MN NID, 1£(mezoline=\) syadern-oul print (FT 1s Oe Prime number { ee § . ; doy Ce 25 Kerns Itt lg it (nateso)s System: vt. pringl Ch +"Ts nok Prine Mumrery Hagel) bee ¥ 5 a 14 (Hogs co} : Sym: Out PHN LATS Pime mumberty (xi) Program to prink element of Arve, Impowre java util} class Arsrroy. j Beublic Steetle vold maln (Sdy1 rg C) args ) x int aCjenew mnt(e]: Afo3= (25 a y<18) AlI= 1b" al4 1 = 205 a {41 503 for Cink Led 4 (65) Let) system outprind in (Aree. element ave" at I) | _ouxput _ (2 (6 (6 LO 50 ) | GW Program +o pnnt_a Stn. au memed — Public. class Sty A PUblic slate vera main (String. a) ar gd ) 4 YING Shere" 15 Sony Kumar’! SYA OU Pty (Sal: Conc: (Str2))! Gystem: ott- pr nidin (Strt to Upper Case ts}: ; Susternour: println (Sty o4o Uppev (asec) )" System our ponttn (Stx [+o Wwwer Case \y system out prinktn (972+ LowerCaser jy} Sysdem-our ponniétn (Sty bequeds( stra) }" syste: OU pankan (AID CUUs tag ore Cas aS+49)) iu OUP Let My name IS Sonu bumay MY NAME Is SOND LUMAR My name 1S sony bumay False Tye - (AY) PTORTAMN HO DIV For @ XW) Program fo point ConsHmetron Publta class Con Strut ordemd , , public Steetic vold mat (StI Targs} Swident Genew Student OY} S+ display. Students » class Student 4 Private Int YOUND; Prveere oad mart; public vold display.student’) 3 System: but princth Chouno" zoltno +t “nara mand; QUAD Ut Sollno O Maves 0:0 A if; (KY) Progwam to Pint CoOMetstutoy— Public class Constr uckov 3 4 Me a 8 Sang none’ loMuyyuetor U Azo Names “sonu! 4 ‘ Votd Show) ‘ Gye OU pring (At" “ayname): { 4 Class New 4 puolic Steute Vord mah (String. (4 args | s “ COMMU Hoy yegc new Cong Tyuetor (J! S2F Show Uy VW} ; \ ‘ \ 2 WW Gommand Une argument cheek prinds ctl th VIC - Pulolic, Class Argy \ \ Public Stetic vord main (string args(s) doy Cink l204 (cov lengmns baa) Spe: Ole privet args vd); 5 = com pile bye fe Hi JOVaG Argus fave) ee BUN by > B java Asgy 12-2 Wii Sonu 123 Shot onrealme 8s 5G 4 5) G: Sg oul eo UO OS ake @) (2) Undersyending Oop contePH and boule of. Fava P¥Ogramming: UG) Object — Public Class Object! ; \ Mk ~s x, PUbC Settle WOld meun ¢ Strive, owqaCl) Q Objectt bjs neo Object); Susie: OUce- PHV¥el (Obj! (it) Abstraction Hes mate Abstrack class Anime x public AbStract vold AnimedSound (J! G Public Class Dog extends Anime : ' Public vold animal Sound \) 3 Sygarem: Ou pringin ("Wood") 5 { , Sheet PUblic* void men (Stung area C7) 4 Animet Obj = new Dogly: Dios AQnimealSound Uy tiv) CneapatuccHon = Pubtc class Encapss 4 Private Ink vole’ Public votd geatue int xj 3 Value} t public Wnt gerVaue O 4 BLN Values % ¢ ClASs En 3 3 Encapsul %o new En capsey Cr Br'SetVaboo, (9 9)" J Septem: OU Print Cy GetVauet)\" Public. steric wold may (String age tty’ (40)