0% found this document useful (0 votes)
6 views

Core_Java

The document provides an overview of Java, highlighting its high-level object-oriented nature, platform independence, and features such as the Java Virtual Machine (JVM). It discusses various aspects of Java programming including data types, variables, control statements, methods, and object-oriented principles like encapsulation and inheritance. Additionally, it touches on the importance of the Java Development Kit (JDK) and Integrated Development Environment (IDE) for Java development.

Uploaded by

Avinash Khandale
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views

Core_Java

The document provides an overview of Java, highlighting its high-level object-oriented nature, platform independence, and features such as the Java Virtual Machine (JVM). It discusses various aspects of Java programming including data types, variables, control statements, methods, and object-oriented principles like encapsulation and inheritance. Additionally, it touches on the importance of the Java Development Kit (JDK) and Integrated Development Environment (IDE) for Java development.

Uploaded by

Avinash Khandale
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 51
| xy ‘ \ [one] 7 / | =/ TT ava rs _Java_is high-level object otiented i ‘oEm —L 2} | and_con UtiNg_pl ! ___designed_go% veesatiility. land SQlablity _=James_Gosling by in 1493 % LFeatukes - ) Plahy0ein Independence - Java's cade MAC, linux, Windows Tih te plgstin ndepontnt java have vm and whatever code weittep Inj joa _agter sons that java cade converted inte _ byt into _undetstandable cade. : | -Java uses the witite Once Ran Anywhere Cujopa) le Programs aeo_Complled into pytecade ,which FUDS Ohany _ ——Platgakm uth a fave vietual Machine © - mel ent —2Aceptian handiihg and Funtime checks Es 7 ee java_secuee Q Manager prevent ul unauthorized access i 5 pROCeSSO® _hocause jou code fs much -longoe (than processot and bakdula ee i SLI Sa reap me eT Lee eer Mistaxre and then opti mise f correct code to OS _ IDK _ SVM. [se] 77 JRE ia Java_develo} cit Machi e uti my, Foulzonment Tt-holps to_wikite _Tt helps to execute Java_pkagtams and the java code tearsate develop the java __ the java Code to OS ret the fa apr appl? code and it also CORFRC the clovelopees Code Tt contains compiler : L -stcontains jaug linker, intetproier —_Tt_is platgotm IDE -Dodumeiatan dependent. Standatd Jib ray java _indetpreiee eee is con yeets Soyece code wuthtion In fava into < uv jal ‘Machine can execute UP ey ecutes the complied tytecade.on the host Machine =! due} de in source fhto_bytecode >The bytecode Ps erecuted <_patt of the! IRE Pheluded. fr ea by the jum , which fe the JDK ‘ OTD vto the dang tla: ee “Hoye Soe ie tee pee ve sare tel Fo Sprig We Aye0 by dale a Banic type Oh } byte = bits i =128. to 139) 1 1 ——dbyte +32%62 to 32768. i Int byte ~ 2147483648. to -2 147483 648 , long. Q byte g_ 223,372, 036354115, 808 i floct\" ¢_byte 1.6 igi double. -gibyte 1S decimal 4 Boolean _t_bit teue | Fase: ! Chakackee >. byte. sing Je chatacters * -Nan=Peimitive data types - ___| oteinge in javq ate immutable | Q | 6 7 1 | i cations : i=can beidimensional Gt multi-dimensiona) ® Iictasses - ‘ "i + den aitefbutes ahd behaviours , \ @ -bp.gno a contéacttnat fy ing. ¢lasceg. must ddhowe wee isy methods Pmplemens but do hot pro ide. the imp lemendat on. themso) eo.i | pst ey © Enums A specfal_cHSs that Eoprecont: a guied see of, constaths — es wat Y \ Nigh het datatype and vaklad le \ i —— ap wees | Datcitypo ~ Datatypes ake used to dechee vatiables Land to determine the type op valuPs that c00.D0 ascigngs* [te those vatradles oe = , 1 ito stake date tht cae “Vatlables — vatinbles age used -to-Sinke dai that can pe ~ .-Manipitiated by the pkogéam. They_cah_hald disgetent > values ct dinyekent times. -tuélhg the execution of the | pEogeam —— SE Avaviable -45-pelmitin ctype called uagiable —— jf tatiable- op; usen. depinet daicunpe called objeuts | , x Whyweneed datatypes 6 9 oo sede tao mith nena a ae ere ive q = 103 datctlype Uaelablo” —_titeral value Student s_.. User degined _~” object vakiable) : —¥_|| Opekat : -nelthmetic > tty TAWA yan shine rar oa —— Relational ~» <>, <= ; 7 - ——} Logit > 94 : oe |—TuEneFy sy 44) ~~ |} Dew —> new 7 ——f-Assignmen = , ‘pets a8e-syminls OF foynotds ted a pete opetatfonson vakiables and Vales “they. oreo. fundamental pat opt he _ donguage dnd.axetategotized [ hanod_on thei Kuoctiondtity -Constol ctaterents ~The ULES ty _be conteol led 2 edieected based on speci pic inns Rodeo: L-Thoy allows yk taltnaigordéceloan ey MIS oe f4inp ty te S 3 cond? ¥s teue. else statement ~ Becket tie uact oy cade: then wt fe. te Ue dnd another f. ib ‘gal 2 elce-ff! | =“cherrs ‘mutt ple: condi ions aequonfially st Nested ff.--else— T 4 S, fo ‘a _hickachical ‘way whore the frinez cond? dépeng on the cuter cond”. at © | switch cose itt ie Based on the irkerent PO2ts ak endo Can be __ tig mitttichatco:dectsidin. making select Sent. Tt Msed uvheh we. ae to gelpit Gnly one. tase aes rnultiple cases. Baksice? Nou- use “the om a ecufe-A. -fode lack aaheh d_pekta)n cond fs met. FS ement 1 as LE aD Qvelse dadde’ (tiple 3 once. uilch t's proutded with an | stant ov titel! expkession that cay value op the oxpkession 7 matched witty = id _does the swt Saale, se fo gouas — frond? ran be _Pantessfon thet be evaluattd _eath test tase match Ts Roriod . rp there fs Ho Match ——the depart, ca ssoclatied code executes. i [ =Lwihich datatype ch we use In Suitich, LA Suilich works with the byte, shokt, Tne, chae ptimitive | data_types Te also waeKs with enumerated types 4 a I HOok passible execution paths —l-need Of: break. bid Tt fs used foside the suitch to jetminate 9 Statement #s used to exit a loop -Tt fs sometimes desigable ple cases without break siatement both them, SEIS decated as an fhstance vatiable Byte 0 Float oot ; enh Short 9 Double 0.0 i L WS: 6 chaz oull ven 5 AQG. ol + Boolean. fala, einer Hose need $a finpoby 2s classe i USE. ites pocnaae fs auromaifaly fmpotted -lYou need to fmpokt classes rom otbet standatd pasxagat geo othet standatd packages such as java. 44 you have classos fo digester pautnget uilthfn your peojecd. You. peed to Tinpokt them . hi | Howto fmporb a : dik = Twmpokt a specigie | vis Suis) Tmport all clagces Sram. a package Trmport Stic members Of 4 class to use them without class +tp_mode] complex data steuduces fn pragtam. 4 M hew class Gtecte Nn ead-Usar desined ef able” an i yob\ch_does/ halde spetiie_datn ! ay i ‘ to decide. haladmuch an what kind Seaehsll 40_dllotate | cons teuct }achas bluepei nd = vari e class holds | maindaln js owh data. it dopbaer int ay QE 10%.-/) initialization ge x04 /hassignmerdr sae io) [essen] fay s ipsi¢) and data \bteh does SoHE g) ea tc, lob collectively ‘ 2 j Lit" Fun’ “deph-contalns the group’ a inste® = FUn® must be writen faside the cass Z= Fun cannot be weHten Inside any other sun = Eun) da must be encioged with cugly Braken a, Fund ret O data ——_> fun? rem) end with semicolon =Fun’ call be made peor ay othek fund pnt x Eun? Rete value [Ty pe- ona at 5 Fotubhe value to the caller un? then’ iled Eetuth: *_Imethad deciakation — you devine what type of value the fethod will eetuEn fn Hs deciatasion | TEN Statement -— You USe retuny fey word Wea e Scanian method deciataton i amethod tmplementation qi Ee Waku oe § code | Seusablity + STs ussite with ses 4 WOU F MALT AMA Mana ae ato. metnbets and. zh ¥ < Be fa lfime entity whieh Ee) Stencawen “s metnbets|_AND behaviout [method] o¢ same - + class. 7 freee] YT oo are] 7 7] 4 _| Global vatlable - Tt fs available “to all gubwiiibin closs Tk 15 votfable by desdult Inialize with peederined initial values — All_numetic. data types (dato shoe int, poh double, tena) Initiatized: with © “ Oulava chak \nifialige with space.) "i acre } a #. | toca] vokidble- trig auallable within \ __| They can have same with global eae but while execution peecedence given to Jocal_vatiable & rt con ase Must be Intiallae bopore Use, fj -- Lith (edd * Local variable 5 Global vakicble “create inside _a method —"—__fngido aclase oudside method within d Same method only withing same-class a uisid © Class alongs. wai throbjed. Mefpott{___rnethod gee Si Heap memory deed -liyedia unit} methodgot led) until abject get gakhagp Collected Sayty| No Yec Tei No tou!t Yoo! niicanboriaeaa i ts ebay oth jee fh Fingl fp Nosurs i lave si Yostuilesay ter 17g Sialic No Ves. fs sy, This keywokd - Point “6 ister: ings daha, dala mernbets Method , ConsteUtto®.. " oa ser ike el + How to point fo a method “to that global vaetable I both ocd. ap. soba dedarations 9 eh tO! USC th) ¢ Keyunoed Le F“Toveesolve narofng: contifus boro Tostance vai abley pakametoes * To clotlgy the code making SF caplet thar youate Eejetting ty the fnstance uatlable of method ID (ASES.0% method chaning o& consteuder. chaining 5 labhen passing the cubtent object to another terhod Leonsteti 1 : 2 : ' Const uttoe — It 15 sperlal method name aS same Class-‘name i. =It has Ho Fetueh type. = Runs when object fs ckeated Objowive - Anu mebbod Which code sho Wd be Buns testy: ONCE object Fs ceeated i Woomianie Initialize - the Lobject as fts. state. =8.' (iereonne type code Bi: Code: EUNS: boraee au) mekhads LS Tt Ps ral) og: gutematicaty when a object fs: cheated. Types Dy constetittiog Ne faut Consteuttoe'( No-Agg Costeuctoe) Aig =A _constEucto® with no pakameters =Sf NO constEuctok fe » 27 || Patametetized Consteuctor + A_const¥ucok thar artoplatguinenie sv fnidattse die < Ea} poet oufth_sperlgfr wales, nk ~ Uss - fis a Pe. Use an consteUctoz. * the, should be added No Arq. cohsteucoe aS well 2 | Pilkpose ak const Eudoe — Pol na A const! ii Halt: "i when ft fs ckeated 4 Use the New keywokd to cxeate.an objects: -_ tut y a _sfnco fts zale 26 Not:to Eetuep a value bur-toiserup the: initial state Of al abject, Lng: wowd be unnecessary and gedundant. use ines # Encapsitlation. tt {s the practice of bundiny data Crtolds Jatt pu and methods Cgunuion) that ‘apekate-p-the- dea nto __ “lL sfoglen soft: \ - A iss_and testing afi a ume of aes col ets 2 USE OK acess ig ike plivake -pkatetted abd puubtie, a _ A Beds nb anzien ' Hedi 4 Related: piolds aulith! methnils bss design ntacieity Tk prouides.armechanism i mds eom‘the 8 Necos tty theOUgh pilally called golitts and seitees Conteotlad access: mernods typ = Br HLPo)0 ¢ pure Saaieanacil i LH beans -/) endity £10ss= core Java: a ! I Aeross Spedsice |Madi nee + 1] P¥ivate within 4 Same cldss+ 2. = age 5s |l peotecred ~ witbin a.some-pacrage and Hs child “clas 5 4. I pubic — Ghywiheke fn a’ projects. i Note= Al) aCCess-snociiok used to 4 “tonskeucjor nested Css: _& aahee tian Tt Pte qa metbanlein in aa fuheke ohne dae Toheetis the —itnethads* op. anorne’ class, peasy J fee] 77] ap entia elas ( sutclass)- The class thar Class .and-can have additional Sloped anitnodade teas 48) j_ extends o8 : Beni 7 ‘fnhetHancé* fn most: ¢ fs os Java = class child evtends patent aw ¥ # Types Ols Inhewl tance - f O.- Ws ingle Thbetttance: Ae Ua -A cla i i ‘ ebb Jee DAL Bais) oot 1 att = sAAlass ROMA Class avchi}d 0 another class Loriaadal io £49540 ody an oa poe yA nis ob t PE Lchdanin aa 3 - 4 Str ent Cass. 4. || ulti ple - A class iphetrs prom mutifiple: parent: classes. aL Not. fupepstearany 4 dN cht, icf : Wi Adunstaton> Arjuna GlanGhy sor + Fug 2 0 cose ees siaapadd ad oye : ECD = Tt kescks to the immediate parent cacg OF the curgent subtlass . Used nok |. Calling the patent class's consteu Gok a> Accessing the patent class's eethods 1 es 3. Accessing the pagent class's pads fF) can of @ culed one and must berthe fect Aatement Supe’) 7 mednt fok_fostance tembegs. “USE padFentclass Name. method Name ¢ doe Stabicmembors pt ass ~Polnt to pagent class d#ems =data_members - methods- consteuttat = Super f ic at gence uatiable It the fmrediate supeéciass Fostance vatiable: The word SUPE Came Into us usa ge becaise of the Conce P+ on fohekitance. The keyurged Eeeeeeeeres| Tosi cal] &_mehod Gsupekclass + . t gem o S$ SUAS Belationship in: — OUB_peogeam Supek (0 be applied to vatiabio Consteucto §S ahd. mothud Supet keywokd vee eebReSenIs super COs object Ht rts CU Variable thes Same _hame. . Fi pena ath | supelads foe varhbie Supek.M/t); // st method - Super (JI pot consis ui trre r frat] J owe] 777 Recuésion_by_using sup call to-tonsteuctak wll Besuit To compile. oe eFEOE Ih fava 2 2, oF consteU toe bet ren Ta fs used a Membek ox a Cuktent object within the Thstance of 4 mehhod | consteuctos ~ = this -Eepkesenis cutéent Classo aoe i consteuctat an: method ! ) e this. mrs I}smetbod tase th?sa(lo)) //To call parameterize consteuuise of ouseea class object 1 th mse of-varlab le, same ease Slobal wmtiqtte: iN gor “ae called: Cal) tO COnsieUGoe. by using this ‘tbtsto” must be pest sine . : Yoside method () rc “Dot cbtouwed thas fs @ul to constetictoe Dot alowed Wwe} neyo puts aiitomaticaiy HO te wad dice cup ee L) ‘this (9 Cal to consteudok Bole fer} io 294 VR Ocrignd-F dewey [eel This py * Sutpek tence vaklable ente.u see Seubeent Class contains imgoadi ate Su ‘1 dss E| i { Super also can. be ip. TWO Ways +wo OllTo invoke werent Class -@ To invoke immailates ok Varlable & methods Cla sis Vatiableand methods this.d) SupeE.n ; this. mica, super .miCj': ® to invoke uiteent 45s” @ To iDVoE @ inet Sanat é CONSteU COR « > CIOS Gonstemetars « arldble ts fostartce Vatictb!e-.and: cannot Postan eEODCE Vatidb le land cahhoty be ACCOSSEq + be: epee BEM State. eon Stahc contest foment abst g is bs call to risC must be os allar'thie ESE copsteucha only tl a Super.) musts se Ar ith ey ays # lass 1 same +4 psemeacan A | hy does not support operator overloading — p= | oars] 7 7. VU FIs an_objettsahility_to take on.uaei vatious oems\s61 enables Jus to.complet cone aution-in-many_digpways 2 _ it p-It_fs_usepul. Th.cak eying. out Inheb inte éatesseu incu | fo_digperont cases ee + ism tb) compile 1 Bundi i } a i 7 ‘-compileTine i Vt) Run Time saad | i aa Ase | pind tng data at compl le Binding data cet Eun time limo Ody al nodtags °| Techniques © Techniques = same class _+\ = DBypEeht Classes st J e.stoted % i e_calied the Gptmization |. 3) | gtefng ‘class: methods — It _ptavide numetous method’ to manipulate and process Strings Such as concatenation, comparigon , ubsteing exteatto Q ete. * Reais 120 \igaln (aol ths 8) | Declaking Seings. = Using steing Srterals aN [ome] / Jf. Lising the now coy word Tr ceeares a new Stelhg_obpeey fb_the heap memoky = 9 wthy-stefng 7s Tmmutaple 9 ‘ tid =H stk ft t due to secutity Beason. ‘jl-once “a Sting object £5 ceeated Ft cannot-e changed 9. How e ‘opezation init ckeates now —jMemo#y but wont change. fts original steing +. | Memot 4) caching “og Hashtode 2) 1 ThEead_sayety 5S) fase of use mal Serutlty — €) Design pkindple (fail-Fast Bohaviaw) siting. SHei ney Rupr pes NOtcan pe modijy) No TTheead a - + ape: ~SaKe Sapo vi No © Yes, me New New no eth'g (Odd BOIS b contents tehdt seq yit are Js need to COSA hath tinge asses arate Opetatee frsere] [ oare 7 — thod___Tnp we 2s = metho ie Et Name i ™ i ee +——besceiption ! i 1 ength 0 7 | Int Fes Hho t 2 String be | t | ay chat At _fnt_fndex | ehae Returns the Chagactee lint index ) ‘ : at the spetiried index 3) Isubsitfng | fn Siting RetUENS q.sunsiting Sitetng : Igeom the sped ped index. to the end of siting 4) hequalc: Lo byectanopject! poatean [compares this stelng aes the spetisied objet vokssi : : i S)_llequals ignote_siting anothe: | boolean _|campares tux sizings Case. | _stting ignating case , . Ginanalte ea 6)_lleantains ence__{| booleah __| it the Cha..Sequen ce contains the pect feM % 2 i equente of chasetiod 1) [starts with | stethg pep | ! with “Hesiging pbpryl sis sh | the Sperifjind pepe —8\ 2] ‘if Ngati! bodleah cher isting onal sHfing Supe) pity hse este Spotted su * pad spat ert i ) “linden of | steing int [nenuns neni je jecdetaneah sig WN JOY java dood Nod Aiow mutiple edt th @20 OW Clie, =~ od] /eacena/ pbigitity Issues {supee.c) | sarne meth farm pare [7 7] PUKIOd Subst lash Indexo} Steing — Tht Reluens the index O, last stein ste occu teence o} Spe Sut 1 J} chagacters in 4 = sting Conuee ha “ steing_to lowercase ae 12) ow ppee-casey giving ta unpertait fen $3) teim Oy one steing Removes leading $ tea Mt, : whites pace Keo Steing 14) Heeplacecd ena Stting Replaces al] OCuFFENCe oy 1 : t old Chaz. ~with newches $8) ll spit stelng Steing _gplith the siting into an axkay US: oF an i ' t af -subsiting + a EF 46) __Ivaiueot object teing ROMENS the stein, Aillen. Ores tn Mel ‘oq the Spe i Dbyeu. />. 11) lfsempigey ~ boolean the sting % 4 empty (length 7 2) used ta. abgine q conteatt oF a Bs Class method: me must ptoulde: pn {ntezsace can a Pocude constants: a cls ae. ec nested | frcemf ey Pex 2 ee fowe | TF ei] =e] Inte jate = noe 7 |_Absteact Methods - aul a aee_ansteact These meth don " ——— a the classes that fmplement the Ente gace i | i. Datei yaw ’ 2) | constants - All folds dh an imietgace ate Fmplfcitly, public, - |Staifc_and ginal ethods - 7 . 9) impi™ Using the depault intitornuatd t : “4 4 This allows a ist without peeaking “the implt clacce 1 wey 4) | static Mothads - Inteesaces cab have sintic methadsi;@hichcan _ be called without ab object and abe speri pic toa interme §)_[quitiple inheritance ~ i wii ple} c allowing iiple_ tn hes) i Idaps hor dlow with classes 6) cunctisna| Intekaces « Ab intetrace: with q singloaberuct method 4 aised tiith lambda i expEpsONs:) ot es niin a i dhaveat ad oth AbsieatHan and IntezRace : Absteact class Tnteegac {- 10 methods ~—Motiables!! al (instance, ginal static) anly_puze_constatt _—Consteuctot ye i Not Scope Hl allt peiuate dopa! + peolected only pubsic Public) absteatival- naéiialiy 0-997, faily [100 7] ¥ : —typesog tl sing te Multi-level multiple ! cinbeaiy hieEa chica! i —Keywookds|_extend s cb InieeRace implemonh % | Final ~ yt 4s uced to deine Constants an¢-tn kesieict + : Anbekitance/ Modi ication é I Final vatiables- A Vakidble declaked as pina! Key word become Q_canstant , onte q Od! vasianle assigned a value it_caphat be changed FTE value must pe Assigned atthe time of dEciaeation of Tr a:conste u oF 5 1 sl Apter foftialization the valle tahtat he modipied. i 2) efnal methods - + eannat bea Subclasses. this i Ts Usprul when You wani to ehsqeey the behaviout Of | Iq_methad Femains un SEPUCI classes $ t =pihis_helps T-peeserufhy the foiended gunatignaliy 2 5 ok the method . teak get 4 sige SY ME fome | 77 J §) | Final Classes - Tt cannot be extended. This fs Used ent. foherttance ewhen ft ?¢ not needed in ensuee that 4 the elasé's: Impl eetnofhs ig : - | a e Immutable _cjasses 2. eau inctionalities . #) [tina] with gepobence Vatlables = te canndt path ito anothes object _ by Ke} fi e i s) lleinal abd consteuctots -Tt cath be initialized 7d g.consteuctoe ho: mitialized 4 H pat ~|This ensukes: that the vgtiable gets:a alte berate Hh object is gully created . us z fd eer oy : SmbGeo ts (uaelables , methads classes to the clase & sic} ithe ass Tk i opteh Used poe utlity guncHons, constants and ehaked HEOSOURERS 5 Naniuy ait iia hb une = Ww Static Vablabies - Thifs shaved iackoss:dtl Instances ona class Teefs Epa foie neces ally Bae on eee ithe value gbrbughaur thes piogearn’s_ execution. ij Sit sto, ang Susans a Seated ee “cannot use this oF super because thpy ake eelated to clefts t0 Hretang LUsemul por. sserianes tn. elt ness | data 3) [static block - It fous bd got static intiatization of a cage [Tews once when the class fs loaded Tinto memoey | ——___sL executed bene the modi. method ot any other “method 4 Fo the class User! toe tnitiatzing static vatlabies_ot-pekgpemming. <= + Setup tasks Static. cldsses- tt fo 4 static member oh the enClosing | Isf Te ori be_accested without ceafing an instance ‘othe enclos) ng lass “ Hoes hot have arress to instance vasiables oe methad $y, © outeE Class. can access’ static Penh cbtS-oulee acs Tt Sintic. impost = St erature allows Fopoeti p static membas ora Clas altertly so they) can be Used without class ahalgjatian |__static: ‘ Tonsstatie clas Objers tab be d6cessed ruitboud- Requites an instances in iceedting an Object 3 +o access. AUlocated once yee class Nlowated sop each objad ———tab_use_tbis and sup ew shaeed EESOUELES , Utlity ___mnstante=s peri gic data methods , constants 0 behav ioue. ¢ Non = static 7 Non=siatic vatiables- Lnique to each fnsianee Hon static methads. opekate_on Znstance data. and eequlee i an nobject. Non-sintic blocks - inflallzation and Gun nega the ConsteU toe os —?- None static innok cidsces - Require an instance ox the enclas! ng class ta be ckeated : fee! Non=: class Eathet than the class fisels, si, hey sequize an object to be si and. gam lane. abject ta doth Bis > 44 L AvEay = Tt fs aidaksleieube thateclins ‘ual tn aroma multiple elements of the sametdata type fo cobtiquoucebiace ‘ shes Lisi Oj, momdry Arkauys at6 tfxed fo size Meaning -thelt length taonat be + Chahded-apter Hie ake ceeated | Fived size. Phe 7B as oe To the _dkkay must be the to the drag meee | Same slype._ = 9) || sadex -lased - Aveay elements ¢ ‘on pe a wh 0 ————L-based fndextng Oe 4) llesicfont Access -Accessing_an clement _by index is ogsiciens use fits afeertly mapped to the mmernoey_ loc memoey_focahon , Deriqéatian - “To ede an athay.spelpy ne dainty pa 4 getiouted by square peathets daie-typely auayslame, Thitialfzdtion — A¥eqys can he faftialfzed when deciated s eee ene Ree at es ul static Initialization = hard med Hi complet ie im C1 Numbeks = LNA of nic ini tidtization -. Ite pe eter Umbets = new fnife)' ant Sah wathe cate See ee ee ee a Fatal Ql SEE ato meq hg ae el in Ord’ ee $) 7] You need to USC helper classes Like java.util AEBaYs o& weite, Custom algorithms Aeray: thierOut of bound €x¢ Hon Accessing Gb _Pnualid fndex Po the atbay eesulhs ingen £ untime eaception 10 [primitive pa Limitation - ArEaIs da tl SiS edu eis U8 tg da tg staked ona disk , which cab be accessed and, salt The 0 Text Files. states data_as a sequence: of ehaFauiere = 4 bain fs human Feadable Eg tetab cco stm IE: 1 ae $115 on.ansieact class. that: gepeeseniuan Of byteg ie . eis. used to: “weltedata!to-d estination, Suchiase pfleneta connettion of memory bupyek st exceptions py using taich bhots handling Throw Tr declages an exception .Thtalls HhOUSeE about. the error and helps tbe usck create an exception handling code stom the outset. It fs used to thtow +he exreptions Noétrnally vy fs gesponsi ble_spe fdentigyiing the exceptional Jaa class cFeating its objeuts and theowing thatobjert' Thkows - 34 6 used to Specigy the method 1evel exceptions If aby methad thtows compile time exception then Caller should - 3 1 Handle that exception by welting tray a block jnside rhe methods + netat 2. Propagate the exceptian to caller Op the method tevol Pxt@ption using thEOws Keuwoed 1 1 E u n i Solved wheeds ateption eepkesents the peablem which an be st ffebtok eepkesents the ptoblem which cannot .be Solved. ExcepHons ia be handled and tah contain the. ptogkam JLexectition- wheke sas SHOES cohtot he handled 1 Allo ebtoks will always be tKeown.ar Funtime f WHCal error comes at — ag L_catmpiile time eS ae cher ed ExiepHon_____. Unchecked Exception 7 They e@ checked at i b me comple time 21. sk must-be explicitay —_uncheced_eavepiions estend _ cag pas hy sinally Exception Handling. « sect’: Mesneed theo? 3)_ Tt extend the It eed he jan Hava.sang. Exception class» Exception . 47 [ltr eopepsent a scenatio TE oc cues roastiy de to See ER eo oe a S) Itt needs to be handled They ake nat handled bythe by the callee caller . Ef eee smear De APL witch sink abt data:r man! wiation opetations ferent mabneet i Dod NMyostos ct of fein. 3. Siiiun TeEEABIC 22 £ Hein wien 5 Laety collection Lie rate ats “lad, size remove itekate, del All, EemnaveAll, clen2, LUist= tif ah. Eniceyace tb Javasutt Patkage I VISt PS Used tn StoEC A Coll pution 9 hy Auplicares - LOY ROS ate 4 OkdeFed collection - The elements ?o G1fk ake okdeked ————" based on thefr fhsettion o° . 1 1 > yp Atlawndupitates = You can stote aupitate elehnents Th atis! 3) II Tndexed -access - Element cab be ACCOssed Fhsektod re 4) Il Resfrable - Unail LISt can dynamicall kesize. Ttselp. i | Gebekics supnoey - [-—tou-cah_specliy the typeiag element sigted Inn a_Uct aaa ai wae Bld ¥ | AeEaY List ~ Akay Lis extends the Abstract tist.and. _|Amplements the trst Pater pace. rh as usally slower than Ae _alheE akeays but 75 usepW! where you need tom -a_lol_fo_ programs _ -Uses_ayhamic_aeea. y. pak. Stating th the elements Duplicate elements ake allowed Mafptatns Pasettionokdee [Methods age not synchtonized.) ' | Rahdoin_access as ft works on index basis addce,e) : 8 ddd_Cint index, F et ement) 1 (iets, | get cint index) \ set Cint tndex, goverment) Bemove (int fndpe) 9s Eemove Cabjett oO). ay size) 1-Cle0eC)_.contains (objett.2), indetoy (0808), — Pst mmpty-£, 40 AEA! you wiheb Aekaylist used:- ! ! FEequent access to elements py Index fs eequtecd sotsan.ond dsetan-opetins bets poccunat zee and atithe end Duplicates ake re Lfored Vist - Tt _f's.a duly finked tick impitaptnd 2 Liseandanegiie teieepat es el [ist ~ peouide osdeted colleciion vopebefions ——__|| beque- Supposts. Oper aions on both ends of, sist - _ [Doubly Linked giructuee eae “Dala- The valueop the node Next pofnte® s. pofnts. to thenext node {-Peeviou's Pointer - poipts to_previous pode, oi) iy Dynamic sxe - ynuree areaye, the size cya Uokedtict . th souk sheink dy namical : Piet A ares - A ify (Maintains tnsetiion odes they Ee added . Ist can state -dupirate elemen: Elements ake stoked Pn oedee Staplements poq HUE = SUPboFty operations stiKe adding and Eemoutng EOM both ends i Slowok access -Flements -by fodex fs slower Not ~synchtonized - No theead cape » {fnkediist() -¢ _Linked tist toma ning i the elements ot given ‘col lection: ivy st + 4 £34 1 ‘When: to Use tinkedtist... >, ‘ : £ the ends.) + by Random access to elements: fs not: a Yoll_Eequibe deque opetations , 5» | wecloe=_31 Tmplements the_tist eae and fe. very “| simflaz to Akay uet er at Veciok_i5 synch eoniaed. making tA a __|| -concuRent access LUubeFedS AFEAYList fS NOT : _SUppokts duplicate elements TA_gkows dynamically when elements ake added, The size. ince edses by 100% wheh needed undike Aekaytist. | Allows constant time access to elements using an index. ——+ Homenis abe sioted £0 abe otdet th whch ney are added. LthEead_ sage. #s ‘eequeed.wlthout extenal synchronization =\Nou_need a dynamic dekay but Eequike synch eopiaed access AZEQY Agtayiist a Elxed $128 juste +: spinarala $20 peanentit oF =| Hormogend US Hete Fogenous “|s40FS both. primiive types Sto€es only_objetty Moke memofl) ep pidert ___Uses_more.mermaey due to dynamic Hoes not provide bul lt Bult n_method s im_methods | Snsertion [deletion adjustment - hey ate easier: imsee and LEequite ed alee on i" eet atone ie aati cae tee eS impietingat Se Ea eet ee ea eas Sek - Tt t fee ae eemet dy piltata na Fe not all lous [sets abe pettnatty “use he ype 50 ta ;MO_duplicate values exfst_Po_ Your tc atten + bt a ua enya lene fad fea ete Set does not maintain WY" OFd PE of. Clermont, Some _fmp!™ atlaw one All set classes tmplement the -CollecHfan. fnietpace Sei_foter pace Hashset >- i fnked Hashset Sotted Ser Hasbsot = iets ust ta nein ene $3644 hy Ney Ftet bee It_does not allow dUbI frate valued t tty to adda duplicate f Does) nor malntais any ord oF ‘ap: a — ements: Pektni ts Cl stag e null Slements atlowed 3 oxedtiashset— tt co mbfoes the sundionglity of a Hashset 7 with_ob_add iti ne ee OF malotalicingthe fosetslan __ 7 Lord PE Of eleme: maintains the ofde® dn wh Inset ——+1ike.all_set fmpl™tiokedHashset does not allow di pliate elements t - ! e __a) | Tropsot = St fs ‘used 4o stobe elements fra sorted ofder { S dit E = Toke tenes ihe obsek o acotaig toa asia — | compakaiok = boes not Slow dupiicate elements a use ¢ es). | ¢a compatfsan 4o_soFt elements pin ts + Sperigies she wupeo4 elements fete th Ww Os AM pally unique elements_aée Slots rw ‘ a1 4 pbieres ‘Iiashset ‘Sntedtnehses Tepesot —tider_iluinatdeked Insetfion edger goed aedeE _ Mul) Allows taht st Aows a Does not allows tog Fastest Slowesthah Slower than / : i . Sa Ee tte iH sptivinget das Anning cae amin: nalts duplicate teint Elements bedat tic fy Eke insobiton dee, e3 not uabahies Cede iG ea tect HOD Ait not atace 1s Allow duplicate element, Allows_single nul values $4 es pot fodexed “ta Clement. is. ACCESS ito eMeNH a ait ve Map - Bok a.nefmpl™ gg th © collecHory: Pntet poco: budore a. Standalone Antersoce Lp RA cane ese ET forme [LATS Meee pashtlap 3+ Es_cnss wich tplemea.Aheap ine pod sirechves, Uliteesbdised sonctbip. snashela te agi ange -] te fs unokdepked whch means that-the key: Mest paunijue Tt may have inuihkey sDull VaIUe 4s ot) paes Dot aay ae aon, ay ITnkedtlashMap - Tt-f¢ a hashtable and stinked tis +7 indiana map, ks Extends HashMap and mairdains +he fngertion order oy clemonts. noo diral ay apo} 3) | TeeeMid p = 1 - cbt add The sivomip fe aentuuunthatppeaek Gugeenen foterpacesusbfch fs: the: subinternare-ay sotted Map QIU UUM Valens ihsmtes nlues nad Keyton si qareand : ete L Netions= te ALP use genekre jor type sagety .which meane ong Sagety . which velngp only pPne-type.og. tibia tags gee “toe, Speriny the type on element fr aclliedion.. ee HL peoredch Joep In fava fe travers ; ree ‘eleme! ofs Eine Be Pas Ane OF fn loops : | ¥ Taenats oieh Jn this tase ~ No foctement deckement . 4 AUST ict oniuints —No-sive icaleulation 4, anit ho} <=Must be genetics gor en iy cS a BL ee fa “auton 3 4 This happen In _genetics there weed type a 4peasting. tt abso u cee Fob wy a donee e obfets You must fmplement the compate ToC) imethed ve a a Lose [77 y “comparatot_iniee pace i es al ! See mer paedte tes by implementing compakatot fmrieksace by oveteidding method | “pub foi compa te (abfect 91, object 02) Hypa can wieite multtple. compakatsés ta compake objects in dixnetent Ways ~ 4 Yo use compaze() method oy compatatar fnietace got sokting, | Collections. sokt (41, NeW Name Compatatoe ()) 5 i | Allows multiple mays ta-compare objets ——jSnetins class Limp —_+|Nou can degine and use diggerent compatison togic | as needed Compakable Compakatoé 1. java..tang jave.util 2: | compare To Lobjetto) Compare ( ob} ereo!, 02) 3. | Degines 4 single natutal __MulHple custom sokting Softing ode & ofdets 4+ _ITmpl™ jn the class being Ampl™ fp separate class | | _sotted lambda 5: only one soéti i Multiple sathng logic cab bevel” €._| Class needs 4o_be modified Ho _modixication to the (to Unplement it class is needed ~1_sorting by single atkibute Sobling by dipperent attfibute _

You might also like