You are on page 1of 87
See eel I) Whot fs the 4, . peng eke Ts pe i Prograrsiing dsFFevent. Prom Obfeck a Progrorstng? M Weed for obck Ofek Radin: | Object Ovientd. Programing eX Progrommritng Povadignm hosed on the concepts of “objects “that Contain Dato ond Methods. The Prony Puvpose of ‘object- otentd. Programming 4s) to vincresse the. Flacbility and rrointainokility oF progroms: “okgect- orfentid. ‘programming brings together dato. ond Tts behavoiow (methods) th a Sings Lecokion (object) which makes: easier bo understond hoo o Program Works - An object 48 0 teal. world element in on Okeck « orientd erviroament Wak may hove. © Physical FOC Conceptuad enstnce. Esch , ckjeck hos + Tduntity.; thar distinguishes ft from Orher> objects in the gystem - * Stok thot — determines +0 an ae he “w 'Behavlay that Yepresents ’ extemally visibly, “octhittes, Performed » by ian object. chavactertstic Propet ObjectS con be. modal to the “needs oF the: appltcatton!! Aw ‘object Tray hove a physical existence, tke oa Costemer , a con ke. OV von Fotongtbi Conceptuok,. existence; Uke a Project , 0 process. eke. A-'clos8 represents) 0 *callectin of Objects having ‘omen /chenacteristte.” properties thak exhibtt common’ > behaviour. pl close J ges the "Bloaprtat oy the daseviptten of the | tinct a. Creabd’) Prorat - Ae : : Cxeakion | oF -on4 \okject 9S omamber| ‘oF o closs ts calls ” tnstantiokton. “Thus 0 obfeck fs an ‘fnstance oF a closs.' The conekitvants of a! cles are_” | ie Be Gok oR obbrtbubss | Br ther! objéets thot ave bes be sfisbantiatad:: Proms: the class. * A sek oF operations tk portray the behovtour of the objects oF the Close « opesokions are also vveffeved os functions or methods. Tuo Poradigins ‘of Pregromrning : |s ptocedutal drtentid Pragromming (PoP). 4. Object!» Ovienbd, Paégramriteg (oo) - Chovoctervistics “and dufference bebe PoP ord oo? : YEA procedisxal Pegranm Progra %5 divided toto Smoal\, ports, callud Fanckions,.. my pord IS) Proceduvals ‘Proganning _| Palle , top dawn, approach, 8) There js ie access Specifier fh preceduvol Programming \ u) Adding Tew dota ond Function is net eo8yy fyb ren Retiows be Progra Ys Added, fr to Smell pats | Collsd... objects - 2) Object onentbd program ring x Follows ° bottom up oppreoch= |) Okject otter pegronn Ihave ccess Specifiers Vite, privols , public , protcbd. 4) Adding ned data 4 function is eosy- PoP + + i OOP: : 8) Proce dus Programming does net hove Proper fox Riding, doko: £0, Pr te bss “secure.” ©) 7. procedaal, pegs ~ mening , oveloading ts, is, net post. In Procedural | Progrorering ‘Punction') 18 “move sTrpettant tron dato! 8) Procedural’ Progeorming fs based ort unica! wrt ' Ex 'C, Fort Bon , postal, Posic eke) | furckiop 2° 8) Object otfentd Programm ing: Provide dora, hiding 60 itt fs Woe Secuns. : 9) Overloading, VS possthl fin Okjeck -oyvfentid. Proggmmteg:s,« » cn “DOP doko, is amore! mpottonk hen 6) OBjeck’ often Progvorn ng fst eased I DOW Teak Loontd’ Be CHW gan Pit etc zg 2. Wvib oO vo. Progra hich Yeods 2 voluss dypornteody and pints the . vorfour Operators flr Note: ‘ ’ ge jan. wtttl package, » OSe Sconnev Clogs. Ot NextInt() Method . Lrmpot Tova util. Seamer j | pubdic closs Main 4 public Static void main (String 3 ange) Scannev Obj = New Scanner [System inys fhe 0. = Obj -nexkTnk (of) s. int b= objenextintO), ) System -ouk.prtintln (a+=b); fio Syke ioutopiinkin (ack); ffPokse.* j, 7 Sysiro out -println (at+), |] 0 SyStern - out. Prinkly (ato; ffs Syprm oud - printtn (gob) to-b) ; Hi2 Systm .our + prinths (oab); [4 Sustery «Oud - prfntln (ole); Yo Systrn Duk. paint Ln (ocex); uy " Systam . Out. printly (o>>2), 1/3 System . oud -Pvintly ((ip0) 44 (arb) A Fabre System . ok -Printhy (pa) 4 (aos))i ll Folse 3 Sgsbrm our. pelt ((oob)|I (boa); [True Sv Uoviter o Tava” pregrany’ which) Yeods" tiny Volina duyrarnicalls ‘and ‘calls Meta ly Leeper Java. ukil Saanner pubte. class Mold i Public Btatte void. trie seg C Jong) 2 Scanner ob) = eto” Scanner (bybtern: in); ° Systern - uk printl (enter 16 valus s; int '&= ob. nexsTAEO) ” System -ouk.pintln (‘Enter 4 value <9; Jat Be obs nexeDAe I! 9 {nk c= meth(a}BYy vec System - out. padinn (MTetele" ei ’ Public Stake foro rel sink » Teton ah fn 43) q Bol deo) 3 - ole s- Erte 38 yaluas oe Land hy. Desex’be the of Vieoring re tech world entities fas the Pow of Aeents. AS the. name Sucigst s, object - 3 Rented. Pregrsierenting or Oops Yefers tolonguonss trak. uSe objects ty Progrornmsing, aims to 1 Implement -Yeak-isorld enfities Uke Shartting hiding 1 Pelymorphises eke. thy Programming ' In thts article, we will discuss how tis” Oops Concept. is implementd fn Veal toorld ) Scenario . : ' A Woy of Viewing h world °— To Wustrole’ the major Ideos in “defect -ovfentd: Programing - Lt ws considay eo | te Pright+ go Glooust : handling. © weol- orld . Sevakion: land keen 8k how ox -Cowd: moks | the Commpukey mover closely. modal the bebriga, employed. «Suppose I. asish to Send Flowers to & Friend who Uves,. tg a city ‘eany mils Quay Yet me, Cobh. oy, Prferd, Sally Recouse of Khe. dtstonce, «there, fs 1p posstbility my Picking the Plewers and Coming thom ty ker doov rays Newevthbss , Sending ‘hey the. Flowers is an easy enough task: T mel, ge down to my Locok Flevtt (whe Vappens ‘ be nomad Flom) , teld rev * the ° vewrely and quantity of Flowers TL ustsh-’ bo / Send and give: hev Sally's addsass Gnd L carr be -assiny vothe. Followers "will eo dativeved expediently ond automatically yO" Oe ies Odea w. tat batagann We 31 ddan yy — Flere. \ Flower Avvanger ; 7 ~ / 1 Aadholsaly regents ond: communities in(|? | : vo Tit. hes only ofa belabouing- © potnt’ ,‘ bbe whew eriphost ze thatp’ the yrachani TE Gack bot Betve my problana: aces: te “dl an" peta ager ary On ito poss to! here omesene” tem Contain?s 5 ‘pny vegndst ot Et Mp ide “Hegpanes Bnity” y "Hol? te"to Uthis ,t'do 18 be pel to eats Pra Pantha withod - — "Series algorithm soy: set of bferakions “aged by Flova. to to this. r rea ce Need te Kyou the portteutan wetod bho ‘Cott!’ “use to Gak¥sFy my vequast, r.duad , often. I do net want to know the datatls. This Puformation Te usually Wdden From | rig! “inspection « bediom p geal’) at i i S Wee o Simpl Jovoa preg vor that Ta) wn, Nathed , clo and object . s. Lyroport Tova. wkil Seonners Sel= Apubic class Mein 4 public static votd main (binges axgs) meth); Y Dby = naw YC), Obj. Ymath(); g public Stotte void metht) © saben -ouh.putotin ("main class Methed'); g g closs Y Z void y mothe) z © . ule Systm out pintln (“class y’ methed 3 i Outpe be Mein css Method Closs Y methed. 6+ Whok! fg: Method: ovedsoding _ wth , ON Brompls + ' A. Method. Querleading so von bs anata &® class has mubkiple methods : basing Some. nome but different, fn, pomamelars, ° tt ts known os mekhed’ overleodiin ‘ Tf we hove @ perform. only one Operation, © having fame name of the. metheds Inceages the yeodokility of Program». : . Suppose. you, ‘hove. to perform addition of the given muebers “bak Uheve Car “be any rawber of arguments , Se you) wovrite 1-the rmethed® Such as > Aint Ant) for two Povornetivs ond a(fnt,fet , int) Pov three. poromelsys , then TE mol we diFPicult Rov ype aS WedlioGS ether ¢. pupgromimeys to understond the bshovieuwy of the method becouse. Pes rome differs 96, Noe can’ perfevén meted overloading to Figure our o quickly: There ons two fe to evertead Hs. wmethod in “Faso. «| ev oe 4m > By Charging. number of caguents 2 By Changing dstotispe ; By changing number of ay soraots : In ths, We have eventod hon method Rye odd) method performs addition of two hn sh cppabess) onde iBecond b OAM ethbal+ "Rein oddftion of thyer numberS syria vr PYogronn Class -% (1 rAtey ct Soveltth, toc! » scm, f ved fda Stotic vold train (Sertrg axgst) y teby = Neus” yor” ; Ploat “k = 0b}. add 2.9 8:03} ” “ Systern our, printhy ®? “_— flook L = = Obj “add (2. 0, 138 Ig Sn ds Systm, uk pti (1), 5 r amu > ah ee vdonornqd owt ys? Cin? 4 ‘\o SOON Boor JP cadt y erctomorng sank ost é Pleat wetr( Pi mo 2D ug oF 7 i mad 943 eevedes radu! er head Bie MAY yh Vb seuorr ef? veRWIPE F109 yon) ot potbantrove ee Sonn gyal doubls sd (or x stay Ants oF bats VS" radon pop wot) pT ee Soubs a: S Mtypes 2 aUbb ” poipwody pa <- velurn a; L : 2toonn, » to ¥. ae Copdnds 4a a vn bulnayd oe a eld on

You might also like