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

Automation Testing Notes

Uploaded by

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

Automation Testing Notes

Uploaded by

Allen Parker
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 110
oq Mar. 2022 | E “pate (ate Favg 1S Q computer Prejromming language whic ~rcale between fhe Programmes, God of Java_programming (Pounder ) James Gosling - || SIE Teal | Tolroduced- 1995 j Tmplimenlation «1996 £2922 [Histoay of Java-(Ans.by me) orld Tova is @ Object oaiented programming Jonquage. Java language is initiated by James Gosling, Mike Ghesidan & Pabtick Naughton in year June {aai. There is @ Qak free oulside the James Goslings OFFice From thal the [anguage was initially called Oak Lalex this Oak projec] name wenl by the name Green- find Pinally fhe Project Was senamed as Java, froma Jova cofree. This Coffee is type of Cofree From Indonesia. s Gosling designed Javay witha Clc*t slylei syntax to ped ities 1 4 Java languoge is introduced in the year i995 8 release) he First public implementation as Java t.o in la96 by (Sun Microsy stem — Operating System WsE= [MicrosopF Windows - Windows 10 | Linux. - Chrome OS uotu @ scanned with OKEN Scanner For Praroia: .@pr - Ips «+ ipr RAMOS Prove CexerillSh efile 98 kg WApy 2 ___|£ | Development oh Java Jonquoge is in dune 1994. mz | = James Gosling, Mike shewidan “4 Patek Noxghlon Thay ap iAvolved in Aevelopment of Java James Gesling is also Known os The Founder of Java, the Taherled o “Gren Project” which i6 released oh Torqage Jin The year 1995, a | Sun Microsystems is decided to introduced Java language a JQ Open Source in morkel on dale 2.34 January 1996. |=] Fist Version of Jova is named as Sok 4.0 29 -Mor. 2022 Que Whal_is Soffuare ¥ (Ans. by me) joptwase is nothing bata Get of Programs oF set ob J iestructions. Soplwore is a program whichis executed by The CPU. [Generally if is which we con not touch bul we See it is called “Software”. Sofware is tell a Computes how to do what bo do. Dirferen} soplwares Solves different problems. TA Compuler cannok Perhosm ony Jask without sqhleeke Whal is Application? (Cans: by me) @ scanned with OKEN Scanner (ae {ba to (bac 3 ) ween Soplwore § Apelicalion Cans by me) Soplware 1s Programs Jinst e Set of “Application is package ructions. Q_Specipic task, [That operates Computer. peepee is May ov may not ||- Application is always execulable. executable. = [Soptwore is not operating r Application is operating system system based. based. ' = [To soplware does not need [In application needs sess inler- user interaction for action por functioning. Functioning. > yl Df =| Soplwore is used as medial/|- Applicakion is Used only used b b 4 y [oz bel? user hardware, End users, ; ; ; = ~All soptwores ate noty TAll apelications are Softwares. applications. VOL” bsmpa poimm@m1po1g. evel 1 pal > vt a > TF i IDM be j Ao1 sdt ap OnE dW) opige aobyit ot bap t t -lastion ‘ouol oda wy aénne @ scanned with OKEN Scanner lange [Pe toga 1 (Benen SteWhat_is Tovo 3 i ? i | be Bere eee Javo is 0 general urpose langqa—— |__| class bosed, object rererteds sie woe il latgors Eo develope an Application, He Sto. oh Java (ans by sir) | -Jova wos originally develop in pel by James Ge | [un microsystem owt (eho in 1995. > James Gosling, Mike Sheridan and initioted The Javo Tanguage projec Lh | Small Team of Sun engineers call ( | -Joil jolly it was designed oe 6rnq in electronic appliances [ike sbb- | | -Jk was Called Oak and was devel Green Project. = i iby [Why was Java named as “Oak” 5 |= Oak is a symbol ob strength ond chosen as On j Tree Sf many countries Tike’ the U-S:Ay PrancecGa | Romania, etc. a =Is 1995, Oak wos renamed as “Java? Because Tos ( | Glready a treadmark by Oak Technologies. ia | | Why is Tava Programming named “Jauvays = The lear gathered t0 choose a new name. the oye Words Were “dynamic”, “revolutionary”, “Silk” “yal = Java Was so unique. most of The fear members| | Java over ofher names. 7 a = Java is on island in Indonesia where fhe pisst cor wos produced Ccalled Java coffee), It is a Kind tp espressa bean. Javq name was chosen by James While Raving a cupoh Coffee Nearby his ofrice: =I 1995, Time magazine Called Java one op The Ten B te ps @ scanned with OKEN Scanner ‘pare * 08 fo mnneny S product ob {995 0 “Version Histooy = JoK Lo wos tekased Gn 23" January, 1996. flee The First! Fajecse ah Java There hove been mary additional Features 1 padded to The Java Tanguoge > Foch new version adds new Lr calrresp ep sovaiimann sie joodaaa : pales LA att promises WORA = “Write One RUD Anywhere? a Since Java Se & telease the Qracle cor parakion Follows atlern in which every even version {a teleased (A 4 | ios Pp (tines month ond on gdd version teleased in Sepkember Fefe [ ment: L 1 Jok Alpha and Beta 1995 LE 2 TOK 1.0 93°F Jan 1996 LT 3 JDK I+} \gth Feb 1997 L q Jiseehawnotlag gt pec 1998 t 5 Jase 1:3 ge May 2000 E 6 7 Jase 4 j 6th Feb 2002 - res J2s6 50 Both Sep 2004 ih 8 Java SE 6 WER Dec 2006 D 9 Java sé F 28th Joly 200 ieumtoo ffeprio x © Java SER pk eth mar 2014 ii Java SE9 1! 1 21St Sep 2017 42° pair Java SEjo 20th mar 2018 13 Javo SE 1) September 2018 (et Deen Wa Sova Sé\an7 March 2019 Java sé\3 | September 20/9 Java SE 14 ' mar 2020 Java SEIS). ~ Sepkember 2020 —Tavo SE IG "Mar 203) @ scanned with OKEN Scanner | Application . te Mar. 2022. {lca re tbe’ ) ty 4 | en =Aoplication is a package to perhoren specitic ask, ~hetording to San, 3 million devices ran Savq - There ore Many devices where gava ts currenHy used - Some of Them are follows: * Desktop applications Such a5 acrobat teader, edz || Players antivirus, ekc. ¢ Web applications such as irctc-Co.ins javatpoint, Com. etc * Enterprises applications Such as Banking applications: + Mobile sEmbedded system + Smart Card + Rabolics * Games, etc [Types of Sava Applications : 1.|Skoodalane Application - =It is also called as Qestop based ox windows |Rased Qpplication’ These are sorlware thal we need to install en | every machine. =Examples oh slandalone application ore Media player; ontwuir Us; Paints MicrosoPE Office, etc: t = Ast and Swing ate used in Java For creating Standalone Opplicatians. = Ban Slandalane applications does nak required Taternet. 2) Web Application - =An application that cuns oo The Server side and creates | dysamic page is Called Web application. @ scanned with OKEN Scanner (ne oa to tba 4 amples ob Web applications are Whalsapp «Gmail, Facebook , jpemazon eke. ME ee % Lh genlets 3SP) Slruks, Spring Hibernate, ISF, ete: Eechoslo- t ~& Used fer crealing web applications in Fava- Pications fequiced Inlernet: af Ley tise Application~ hoa 2 i ae Se ee er Thal ts distributed tn_nolure + such 96 banking “applications »ete: it Ts cated ab Enlerprise_applicaugn. FW has advarlages Tike High-Jevelsecurily Toad balancing Tn Java EIR) 'S used for Cledling enlerprises applicalion -—+7- Exomples oh Enlerprises applications are Google pep — [Phone Pe» Billing system. ae —trimabl Tication- , iy, Moblle Repiication ° i An application which ts created Cox mobile devices 13 called [| Mobile Bpelicatian [= Currently andrei & Java me Ys used For creating “mabile dpplications. [= Example of Mobile applications dre Games Tike CPubG , Condy Crush - Talking Tor, etc: 3, sharetls Instagram - | A | Gut | Why te learn Tava, Programming § | =Javo is 9 mast bec Sludents as well as Working propessionals to become @ great Sottwore Engineea [specially when Fhey are working in Ssofhware clomain tThere are some key advantages °F learning Java rogramming + 3 i} TL obiecl_Oaienked r ® Jr javo everything js an Gbyec. Java can be easil [extended since it is based on Fhe Object model. > This dives developers fo have q wide variety of Oplions for designina {heim suthuare. | @ scanned with OKEN Scanner NY “Platform Independent! : > »| 1S asi Independent Means A Prograny Conny Q one machine can be execuded on any rage T the world wilhoul any change. x *y Diava achieves plalparm independance by asia ‘ op fhe “BYTE” code. a Sthis is where the “Write Once; Run anywhere eR ‘ for java comes iE means Frat We cao develop opi On one environment and ran 09 Ady other enViceome without doing any modification if the code, Aen) poad, oyet 009] of al ag ~ Z em [Hindi ipsiede 282 (mF os) oy | ] J | : Cvs uivenmitis tee ab Linus t ebinw — Cainpilens pe Se Bens A gv ©) ro oa oF as iialio Cea ern 1 as/ aya 2c plattarn ho a independent Solatise \e JvmM i 1 Fido apse tp QV Po Macl ajdbpoerts5(al nd apie Rx art al fees sc a a @ scanned with OKEN Scanner ca ‘are > ‘a Simple ab ek Age { 5 Java 15 easy to learn, Simple Syntax y clean 4 easy to ! Pardustands ces | \ Java having cuin garbage collection 1 hag ne eed To vemad erence object: sass dina aan “I +e Portable fo cary a is a porloble “because (b Facilitates’ byle code bo any J plalrerm TE doesnt required any Implementation. | 5. Secured 3 Java is beel known for secuvity. (> By using java we can develop virus free system or security. ie Robust j3 tava is Tobust as it is capable oF handling run Time errors, ‘Supperts Outomatic garbage collections 8 exceplion Randling. TaTava has q lronge memery management system. It helps Tw Sliminafing errors asit checks the code during both | compile § runtime. He Java Classification: \ Java I : a | Tova SE ‘a Tava EES Java ME | Coesktop)1 » { Cinkehety 0) TCmobile) | (I Jove SE Cova Slanda d Edition) |? Mainly used 19 the programming of Slandalone] Destop Application; xine j > gall 31) is g Java programming iplatforms . 1) includes Savg | presramming “API's Sudbjas: jovaslang> javdaloajauas nets | SAC §«—_ — @ scanned with OKEN Scanner |S. Tova me CTava, micro edition } TV \s a micro plalrorm [hal 1s dedicate j oem evelopment such ag mobile applications. Bete le MERSIN prahon = i Installation Procedure of Java: j Th Your Joptop already have an ol Version Cp Tava IDK Fhea you need to Uninstal]| 4 Firshs j et You Weed Ys check is JavadDk 1S Present om Tol ip \pur lophep, To check if follow The belfou slepen se You need fo qo into Search bar oF Your laptop Then in Search bar type “cmp Command @ scanned with OKEN Scanner aay Dart) oa fo (ot W) Nome 1s recognize to Nhe 64 slem Ltss rr aT BY 06 Javajok 16 nol recognized is Whe syslem.” - yes e old \ Version of ‘oh Java reer | the S{slen older version e “Control Pane\” | Faia pn sa rar ae ha Abd ubindtail the same Tnstallation Procedure oh JAVA) SoPfware in Our Vapto T Installation Procedure Cox Windows jo - z Go 0m “Google” & type “Java TDk Downloa Theo There iS a oFricial website fo download Java which | is TWH, Oracle.com click om that Tink = i Flome Page of Oracle is present on fhak click on “Java JOK Download ” New) window to theres 3 oplions, em Linux nacOS Windew , We downloaded Java ror windows therefoxé | choose | windows option fox Pownlood) Selup file! Javq seit Xjsoe 10% a estes SHS J Tink? Tae a Afker corp bags HetER leading Copy Thal file 2 ew Folder in another sive & paste that Tinl foldenajaye” abdo 72, ii) aoa Then do the complele ia alion | Inslol) Tava in Nine @ scanned with OKEN Scanner Stet “Doentoad hye ee | eethrouetaatuas =a Step: A Her The installation yo Tavg now we — oto The (pC Pq Sle Open “local Disk c 7 Folder Thec Go fo "Java™ folder Sdk=19.0°2 = | | . then select thak —_ path Cci\pro Steg 's gra Copy That path fox Further pro ) cess aoe| Jdk=\17.0-2.\ bin + Setup of Java Eavironment palhin Yeur system, Go to the gearch bar on Your’ Toplop Type “environmen? APler There willbe bap two oplion ehows, 1) FATE enviroomen} variable for Your account [X] Ni) Edit. the system Environment variable selech) They second oplion por Furlher process Then window wil) ghow which a Js “System @ scanned with OKEN Scanner =T sat Hal choose ““pdvanced © aplian teeta - ‘ 2 j+——Thea another Smal window Comes with “Environment ee aaa) _ Variable” — eae 1 ee aad ee t——Then [here 5 ae Variable” porlion io that éearch — 4— a Path —— 4i——STick on Edit oplion § Then click on Edit the enuiranmen variables » {hen paste The palh which we copy from step 4. 5 Then in System variable ‘Portion Click an “New” j— | TTF Java -Home 1s visible k TF @oJAVA-HOME (5 fof visib 7 Gelect TE § Delete + 9 i Gb Go Eo New r } tL T Variable name- JAVA-HOME Chype) pr Variable value= Paste a Tink which we copy Cie. Ca\ program@iles|java|jdk-17-0.2\ bin) {ini oo lilin Jeenmango fo uwhay- [ot aA | s Afler. thak delete \ bin portion on inl i ardathen seleck 0 Ir - - 14 held? ce i @ scanned with OKEN Scanner 0 Procedure of) Polipse Go. to “Goegle” her Search Wpe “Belipse Download” then there ts @ link Whelld -Felipse.org Click on Thar there is @ Eclipse ToE202/-(2 Download x 96-64 | option Then click on thal Run the selup eile of Eclipse ir Thenione: pop up window show There ts q Eclipse IDE hee Java Oevelopers option click on if 3MoH -AVAT Ta Next Window! Install oplion is shows click Shere | b-fI-ABLIPYPL gp EIEREI Le] mb agd Rolo yROET You can Only change The name of String arroy —Forgoment . ¢ oe Bx you can change The: Glting array arguments to — 7 my string Args: | 4 Se Shring Tongs can be wriljeo as Shingargs TJ. = bh - A DUC = public (8 also called Access Specifies of modi pies > public has to be public so java rantime can execale This method [ap ory metind is non-public then it is not allowed fo | be cxeculed there are required Some access aeshiclions. static | static isi a. key Word } | >You can rake method static by using Static | keyword. B | 7» -While using stqtic keyword we should cal] main [method withouk crealing an abject. | Void -Void is a return type. @ scanned with OKEN Scanner =Main 1g A Name of q main method, - This fixed and wheo we Glart J9V Bro, Jooks for a Main mefhod. Progra It string LF) args: | =i is Called 05 Arroy Creation = Javq main method accepts a Single ar tape String array Sram this Is also called as fava: comma | String = Data type CJ = Array args = Arguments C)___= Signature —] 3 = Semicolon Programs By yeing main method. Bx: dopa: : + package basiePrograms 3 wblic class Firstprogram Public Static void main string Clargs) {| System.out: printin C'Nikita Hingmire) 5 System uk: printin C"goge5323724 5 Te a pantera = a matali nee T qd 9096532342 Drauback of main method = 1) In class tuo mi iiWe can't change The name ol mm @ scanned with OKEN Scanner are 8 ps 2 Ce 2 > 8 8 (3 re } at Regulax method oes ii) Won-staqtic method Fy x) Static method i)static_melhod - Dehinaticn = Static Keyword means gba We have 9 pixed meron Senses can not change it os modiby {be i = Main advantage op static method 1s we can call fe withoul “creqtiog an Object. >We can change the name of static method TE Shouk ~The angthio f : - eae method present inside the class bedly & aulsic “The main method by multiple: times. [Note ~)Melhod name Ghould be on Thin. Tay method name dont clark with Uppers case’ Teles om dont [use numencal numbers or Special chgracters- a) Method name coesnit Ghuuld be same Standard syntax of SEatic method - public static void Ei C) Ti ie aia : at 1 method name with method signal How fo call Static methed in maln method 2 aacal —— = MeHbodname with methedsignatare felloc Dist seen, casbde Gas me melbod ndime ™ inethid signa re @ scanned with OKEN Scanner os ‘DATE’ lie I = | Lz Program by Using Static method Sg Input pakkage basicPrograms j public class Statiemethod f "public istatic void biain Cslring thargs}g— gysler oul: printtn (Static method”), ~~ ploy; p20 public Gtatle void pi C) Systemn-Oul printla ("ph is a static method); Public Static void p2C) t weep C"p2 is actatic methad”); i wp: Static tel bed pi is q staticy meted p2_is.q static method Li OY Mar- 2022 jl) Non- Static method - | } =Non stake; method 18 dynamic tn nafure swe can modify it 7 =Rebore calling, Non-Ckatic method into main method TE (5 Necessary bo creqte an objeck oh iS Class § give objectreperence Variable To That method.9 = Object = ti js q cimple emply space famed as 9 rs le. a @ scanned with OKEN Scanner T class. Tipaid le ~~ Refvariable should be anything, sae OO = objecl. {sa copy OF class Inslance of clase, Blue print of | Gtandard syntax of Won. skakic mel By creating an abjeck- Gtandard syntax of Object - i ClassName ObjeclReF variable = new classnamec) 5 i public Void E30) a | ug Flow to call ron-static method in main method F | |_petlewed by semicolon Objeckee variable. methodName with method signalure GlassName= Ib 1S the name oh our desired class: Object Refvariable - I} 1s any name according Fo The Knowledge oF programmer bak if will not start with a qume- [ric nurmber as well as while giving The easee Name space 1S nok allowed, New = "new is a java Keyword used Tm crealion of object. vl a @ scanned with OKEN Scanner | Program by Using Non:s __ Package asic Programs 5 public class flonstg public static Void main Cstring Clargs) ethod katie a System out: prink Lo Nonstatic Melhod Pr Program + nic); 4 public Void N1 C) system. out. printtn Cinbiis nun static methed ay CTNon- static rmelbod yy ogram = New Nonstaticmeths ¢ j ft 4 i Qutput - aa | ay To non -Staticr method [Direrence!, belween Static Static method Ue: =Inthis metho There ts 90 decd Ni ts non Static method mpethed: G Non: static method Non Statics Meth Tq this. method) there is) ne | forcisale. Foveall_ rain cnet hod: Jo create object fo call method. she etted confoins Static Fey key eThe method does nol contain s} rds called static melted. Keyword is called non-stalic m >TPhas dynamic memory SO =Batre mealfed has, pwed meney Sail can't change o« modify: TE change ox modify: i > Standard syntax - [ gfandard syntax - ublic static yord method namec ) ublic void emethed mame ( = Wow fo call Zjalic method in | - Hoe yo call non- Static me main) melred- TA main methed - method came with mel hod tae? name Method name el method signature Follows Fajlowed by_semicelon: @ scanned with OKEN Scanner Fe TAVAKEYWORDS = f ATE (LLL) fa4 | = Jovo keywords are also known as teserved words, t - Keywords are paricular words \which iacls as a key at to a code. al ~Thelr are a Predepined words by Java so it cannot be —Tosed as 0 Variable or abject nome. List of Java kaywords- Austral > Abstract keyword is used) to declare abstract Class. ir Abstract class can provide the implementation of rh interface. If can have abstract & non- abstract method. 1 pom complete » Gomplete | DBoolean - Java boolean keyword ig used! to declare a variable as a boolean type-I} can hold Arue & Halse value anly- \A Break = Java break keyword is used to break Toop or switch Statement. IT) breaks Ehe current plow of program al | specified condition. cose ses? Cine i) s Breaky UBute- Java byte keyword is used to declare a variable That can hold an g-biles data value. put 1 (case - Java case keyword is used with the switch stalement | te mark blocks of text. Case am 3 ihe 6)Catch - Java catch keyword ig used fo catch the exce, generated by try statements. I} must be fry block only 1 by TT @ scanned with OKEN Scanner ——— rd is used {0 declare a Variable Bl [Becher = Sous, char retynedTe-bils_ Unicode, chorae ersi I Wg vi 4y wore declare a class { lass ke: ‘dis used to ; [sy Class Java ¢ atinu i is Use mdbinue = Java continue keywor > gy. Ooptt Ty continues the Current flew op the rogram C gkips the remaining plow code at the specific Condition. i to Specify fl dgpowt -i-Tava default keyword is used yi The dp 2 Gull. block OF code ina gwitch’ statement. | do = Java do keyword is used in control etalemenk to | —Teclare a loop, Th can repeat O park Ob the: program > | Several times. able - Java double keyword is used to declare @ variable tha} 7 can hold a Gu- bit -Ploafing- point numbers: 7] Tava else Peyword is used to indicate the alternative” | branches in an if Statement. Ef BvOL ! wa)eum- Java enum Keyword ig Used to débine a fixed set of Constants. enum constructors Ore palwoys private or | default: i or UFekkends= Tava extends keyword is used indicate That a class] is derived from another class oy inter pace. LO Ginal- Tava pinal keyword is used to indicate that a variable holds a constant value. Tf a variable. 1} is used fo restrict @ scanned with OKEN Scanner T Java Finally keyword indicates a block of code ima | “Fry catch stracture: This block is always executed —helher exception 8 handled or nok joat - Java ploal Keyword 1S Used fo declare a variable ~—Thal ca held a 32+ bit; Floating: poral number TJava For keyword 1s used to Gorl a For loop i) is @ sel oh Instruction repeatedly when Used fo execute —+——gome conditions becomes frue. th the Gumber ob iteration iors is Fixed if is Tecommended fo Use For Toop. d fests the condition. 1 executes the pate = ove inp Reyword ate ip bloce if condition is True. plements - Java implements keyword is used 40 implement | f _ an inkerface: i i i 22) Tmpeat = Java impost Keyword makes classes & inferfaces | available § accessible fo the current Source code. apinslancech = Java instanceof keyword is used to Yes} whether | The object is an instance of The specified class or implements an interface. iB) iE Tava ink Keyword Isiused to declare a variable that cas | hold a 32- bit signed integer. | Ziarpon 7. a whinterpace- Is used to declare an inkerpace. TE can have only i ~ abstracl methods. I Tus san d fo declare a vanable @ scanned with OKEN Scanner ~ | i Leas F——Soayholive - Is used to gpecify that a method is implem 1, ea native code using INI (Java Native tnlerige ew. This keyword is used 10 create new objects, ie . mm: Wie Java null keyword is used fo Indicate, that a reRerep does not terer anylhing. IE removes the garbage yg : Bi 1 so) package - Ty te used te declare a Java package that thclady fhe class. il ; z 2 ed # b-can i é a ad_outside I 7 The—eless. E> xgena| ine >* Deupoal 2J0 jai BL So igiirr Yprotected- This keyword is an access tnodifier. It can be acca ible within package & outside the Package bul ‘ i i Through inheritance any. 1f.can ok applied a moe heuciacs: ot eidie2z9290 fp 2d OKPVO rr 7a rivafe Keyword 1s an access modiries 1k is Us ed] ~ fo indicate that a methad on Variable may Te ac onlg in the class in wWhichuhi js declared. Bz PUBIC =" Ti is an access modirier..qt is used fo indica! l an aitem is accessible, anywhere. Tl has w | Scope Among al eum onesie mL |) lalore ay . paral Felt Keyword 1s used Yo relaen prom a saehed i ee when its execution ts completed. a = a MARINO S10. 2) 1c Pw port pao ovb lo ee Peel. | "ened Th] no" pi: bled naam @ scanned with OKEN Scanner Ghost Sher keyword Is Used Eo declore a variable that can [ = — held aule-bit integerss va 1 ae Lic. This Keyword is Used to indicate thal a variable or —~—nelhod is arclass method, This 6falic keyword in java ts used hor memory management mainly. — ynctep= Ths used fo restrict The Floating point calculations eto ensure _portabilily. ; > ]} 1g @ teference variable that is used fo refer paren’ class object If can be used to invoke imrnediale parent class method: Nal ee etatement that eae code arch - contal a, Swi ate pause _ leneeaseie This switch statement tests 4 I The equality of variable against multiple values. ney gyachronized= This Keyword is Used Ts specify Re crifical Seckions or mefhods in multithreaded code. pibis- Java this Keyword can be used to refer the erHte | current object in @ method or constructor. (42) throw - Th is used to explicity Throw an excephion-the +hraw keyword is mainly used to throw custom exception. ae Tt is followed by an instance. 43) Forows- Is used to declare an exception. checked exception can be propagated with throws. 4a)tfonsient- Js used in serialization. Ip you define any data member as Jransienk Ok be Serialize: @ scanned with OKEN Scanner atty- Java try keyword is used to star a block ep = will be Eested hor exceptions. the try blog a | ~ | Followed by either catch or Finally block: g ahlan Than sans. i hs) void- 18 used Yo indicate That methed sail value. me | Ayyvalattle = Is used to indicate thal) a variable may | __ synchronously « / change — il n® Whe Java while Kegword) te Used for clorFa while To { ORs op Thies loop erates a part op the program oval fg the number of iteration is nok pines it is pecq nded fo use while loop. ; Quel ‘DiFrerence 7 Gelrlicompil es 1 Execution: Execution Tt is a Process -Afler compilation a exeu) Compiler which compiles i |) is create «Tl iso get exetule fhe code Phat means ¥E || when ‘a program is nin. Converts Source code tnto Platform “specit'c qssembh Tanguage: a ei T) checks the Program For ||- Before erecubion Yea need ony synlox errox ox missingl] jo compileia pmgram F semicolons or brackets i yi ; etc. ) Br Dae I 1 > aoe , “ a 7 + @ scanned with OKEN Scanner | ome ———— Lh 4 [ frostetype7 = In The Java programming There are dala & infernal Thal dala ¢ information ig represented by Datatype ieee tsts compulsory to cleclare d slalasentatit the — variables oo ~patalype is like a translater ov i\ is like a mediator. [_[abere_ove two tupesi in Palalyre: ae ese ||: Data Type | ‘Bonide | Primitive data type Non-Primilive Oala type f) Poimitive Data _type- | Primitive dala fypes includes -be G) boolean data type b) byte data type c) char dota type a) short data type ‘ = | & int data type f) Tong data type 3) SFloat data type h) double dala type = Psimilive data type store the dalq of only one type. - Primitive dota type ts a predefined data type by Tai | _ = Primitive data type holds the value directly iF you access [This dota type you gel The value clirectly. - Fvey primifive type has q cehoult value, if nd Value ts assigned, - primilive data type starts with lower case letter @ scanned with OKEN Scanner oe {| Primitive ik Boolean Numeric Characler inhegral integer joolean = Char ye short int Flo ong Data Type Oefhawt Value Dehowlh size Faliase ‘uloooo! 0 4 byte 8 byte @ scanned with OKEN Scanner aa al a 4 alean dala type - = boolean dala \ype is used to Glove only wo possi L—ievaes ihich are tue & alse, i= Tl can track only true or False condition — t = The default cize oF boclean data lype is Tbe a ackage basicprogram 5 5 Cale class Javakeywords t lal public slalic void main Cslring CJ args) | gystem-oul. Paintin CT beelean Dala type") 5 1 rot bodean 9 Q= 22215 | | 5 | J Quipuk: boolean Gala type | Te: oa byte pata _type- ) =byte data Sype is’ the example of Primitive dato type - Us value rangets -128 bo 127. = The minimum value of byte dato type is -128 & The maximum value is (24. = Memory Caving tS mosh important so byte cola type is Used To Gave memo in large aroys I is 4 limes Gwaller Than” inleges- hart data type - - short dala type is also Used Yo ekore Save Temory 4S like byte dota Ttype- = hot dott type 1s 2 times gmaller than Integer = IVs value range {3 -32-168 to @2761. ~ TS _ minimum value js - 32768 & TES maximum Val 16 32767. = N's qefaulk value is zero. @ scanned with OKEN Scanner [Eo O47 wacny C2A3l- oF @ Ut Ss minimum value is <2, NYT AR 864g Ca ies maximum value 18 21448391647 CO AZIa1) l - I's dehowt value is zero. | = Ip Where is q 90 problem about memo [dota type ts generally used as a defowe Tong data type- -When you peed the value tange more than ine then you need fo use long dala type: | 7 U's range value ties between-g,2293, 1310 03e | 175) FoKC- 20GB) Eo $1229 {31010861854 T751F 9 Caneap | = Hs minimum value jg -2563 qnd dis anita value is 2%@3-1, -Ihs default value {s zero. = You need to use (i while Using long: dala typen Pleat data type Gi - U's 15 used wheo you need fo Saver memesy in 5% arrsys oF (Floating point oambers: i - Ws value range ts unlimited 7 ¥ - This dota type never be used hex precise whe = Defewt value oF Float data type is 0.0F) deuble dake lype- -double dala lyee is generally used ye a ded valges . - ts value range {1 anlimiled. 7 = Ih also, Ghould not Used per reed values: = Tis default wuelis ood @ scanned with OKEN Scanner « patalype variable ae LJ ~ In double dala (ype hor decimal values you tot Hted ; “qo put clave Sie Sa pai 5 ‘ LTC acon Cums arvana d es | - Value range 1s belueen ‘Wvo00!Ces 0) to 'U\FFFRY | Cor 651535 ): : a zehar data Wype 15 Qsed to Sloe characters. | = Tn thal the wocharacter have fo be wrile to single qe n add only one character in it. ee | 1 | -\de ca ES: chor- ‘A! =You can't add more Than one characlex in it- Non: rimitive dota type 3h 7 =Non- primitive data type ts 4 data stracture which Suse depined that stores the dotavor diererenk Fypes. = Non= primitive data type is not: fixed goa Te 2 | DNoo- primitive dala type alwoys Starts with Upper ‘case letter. [Noo pankive data types _are- | 1) string | fi) Array + | ii) Class etc. P @ scanned with OKEN Scanner Wasiahles 7 me i] =Woriables is ai piece oF memory which ig Used b— | Shore -\nhormation. ll = Variable {s a basic untt of storage jn Program -y 1s @ Name which Is given Eo a memory Jocahion. | - For creating a variable we can need on informal | he Characters, umbers, special gymbols ov combination op iO rere aa | = According to all iypes of Programening Tonguage = | can not declare {nformation directly For that we con deca | @ voriables. | - In java Prograroming we Can not declare Variable | directly we need Yo declare dalalype behose ft. Pgh | = Voriable also helps us to use information again and again. Syntax - datatype variable-name = Values @ scanned with OKEN Scanner (Spare qhere are three lypes of Varlables = | Yfocal variable 2 } ) Global [Instance Variable static Varioble [class variable Tete VETOBIesgdlae) eieioe oiugeeccm eee ~ NOL C]) operatoy Used Lo make palse Slalement fue t | & Wwe statement false. | Eee conlaing Two types oh operation TRaithmetic Operators - | ] yAritmmetic operators: Alwoys required minimun | | fwo operands . | > Arithmetic operators peshorn mathematical | operation s like addition: Substraction, muliplication & I | division - | > they acls as a basic rnalhematical operations. | | Operators mea ning Work | + Addition Jo add two nos- | 3 Substraclion To substrack Two Hos: | * multiplication To mull. wo fos. l / Division Jo divide hwo nes. - ss modulus percentage To gel {he area , or fuision oF : o nos. @ scanned with OKEN Scanner a) ShICL Operaton- =~ ca > Shirt operator are used fo ShiFE a Sid abhindl iin nat es In | Tere 6 08 right side. | | sthee are two Types oF ShIFE =aata— Eo Ss j ! : i) LeFE ShIFE operator —- a ___i) RIQhE ShIFE operates a WVIREESRIFE opera box'- / > LeFE SHFL operqtos 1S used to che in Vere cide. mal: Sven ‘a xe It Follow the fpsrouta, | Variable value lésichech Rn ate YD FARO oF operand ——_ | Wright shirt Operator - ARIE SNEE operator || > Right shirt opergtos 1s Used to mgiven values to the Hgbt cicle : —s | > Tk Follows The osmula, | Vonable value, didide bas al Saban operand : On I Program Using Onany operator Package baste Program 7 EE Public class Unay Opesq boy c Public “static vod ; F wot WaloiCShrieg CI args) Int T= 104 : sa RONEN aA To oul, I mae tn UNS t= 4 met S98 len 0}. Seinly : Syskem. guy, min PM) 34 | @ scanned with OKEN Scanner 7 | ware’ int ke = 1005 7 system ol Printen Tk IT 106 — ~~ system out printen Ck +5 100 TTR - “8y ern. oul printin CL) i TW “out print C ft 100 a Program Using Arithmetic Operatos- TopuF package basic Program 3 public class Arihmelicoperatoy y public static void main Cstning ty args) f stem oul. printtn Ca4b); istem-oul Prinitn Cqa-b); 2043 = 23 @ scanned with OKEN Scanner wh Cries i ee — A | Program Using GNFE Operqtox y | Laat gree Package keseheg@e) | Public stole void main Cétring T Ae {Nth = 203 se | Syslem - oul Prinken Ch>> 2); 20 Fgre System. owt prinkte Ch373)5 I jo 5 ui System -out- Printen (hoya); I] ga0 9 Int T= 405 System out: printf Cacao 20% gia System. oat Printen Ci<> 235 77 To System: ok: printen (735 7) S System. owt printly (9745 112 ei ai Beer ae | Quip 10 | By Lee Shee | ea ae XE) 0 >) 5x7 2D eo i = a a @ scanned with OKEN Scanner _—_— — be i lo s 2 a) Logical AND § Bitwise ANO Legical ANOCRR) >It doesnt check second condition if First cond. t4 bale > TY Check gecond cond- iF First Cond. is Frye ° 0 ° et ° l ° | _|+— al 0. + | I I Ano C8) - [ always Checks both condition whether First Condition is fue oF palse: a Program Using Logical a g Gitwise & Opesatoss- T Input package basic Program; 'g public closs AND operatos ff public Static Void main Csting TJ args) { [ int a= 505 1 int b= 105, EB | TI Logical $4 re p| Syslem ‘Oul-printtn C B TF Check gecond cond. iF First Cond. is Frye } I ° oO ° i] [o} ' oO : : | 0 ° Bikwise ANO CR) always checks both condition whether First Condition is fue oF pase _— - — ——+ | | Program Using Logical BR g Gitwise g Operates T |_| Eeput a package Basic Program ; - L public class AND operatos J ei peblic static public “static void main Cating CJ orgs) | pale int a= 50s int b= 10; ee egies) §4 1 ea fee Syslem Oul-printin C Ub doesn't check second cond: if |S! Cond- ig fais | True. | > AY check “second cond: only iF First condition iF False- | Vii) Bitwise 08 C1)- | > Ib always check both conditions qwhen tireh conde \ion is the or False. 0 0 oO 0 ! I | \ | | ° \ @ scanned with OKEN Scanner ware pragram Using Logical [i_j Gilwise | operates Tr a package basic Program} a i partic class OR Operqtos t pale sae oid ain Cshng C857 int a= l05 int be 55 : int c> 205 tt | IT Logical 1) = System-oul-pintin Ce>b i bays TIF =T System: oul printtn Cac b bea RIT = T | /T bitwise f L yslem: oul pantin CAyb | acedjl/ TIT =T System cal pinitocere 1 by ONT fFeT |G 3 | Gatpud = ll Tue True The l Tre @ scanned with OKEN Scanner k L 7 His Keyword 7 ae the > STNS Keyword is Used To access Global Varatp~, F {nto Vora’ variable Waving Game variable nome bik da erent information . ‘ Suses of This keyword in various sifualiong jg. | ott con be used to rerer inslance Variable oF caren || Class- B TNS keyword 1g used fo initiate carent class l | Constnuctos: lL | © S¥ can passed argument in tnethed ceil) OF th L | Constuctor cal). + | iT can be used’ to Telurn fbe Cumenk Class instance 1, | — Example Using This keyword : | pockage basic Progrom 5 + public class Thiskegoord T_ 4 tot a5 int b; Public Void gample Cinta, int bh) [ this .Q = a5 this. b- b5 Sysler. owl -Priatin Ca 5 syste. oul. printin. chy; [| 4 Public static void mainCshing CJ args) Thiskeyword m= new Tose ot el nN. sample C2015) 5 J sal outpud: we @ scanned with OKEN Scanner [oon Fool Statements / > The control statements are nothing bul a cor on Statement it is Use Lo execute a cet of Statement| “phich are based on a conditions or situations. | > Ik iS also called as Canditional statements >hhen Ehere are a rnulliple situqtion so at Ehat | ‘TEime we need to use a contro] flew statement. >There are the following conditiona) stakerment 19 “| Java Programming : = i ql 4) IF Statement | > Te else Statement 3 IF else IF Statement a) Nested IF Statement 5) Gwike Nested TF else Statement 6) Switch statement LE statement: | >If Statement is use to check condition. Tt requi- | tes only one condition. > Generally as per The syntax, the Condition oF "7 (IF Statement is Tue then and theo only The Progra ra = execute. > Syntax Eo wrike [TF statement- | | Syntox - Te Ccondition) Statement CS)5 @ scanned with OKEN Scanner Dare ‘N | Fl : Serle using ie ceatement— 7 : = oo an ur aol 0 _ public class iFstatement @if ee pe aw TO CBT ergy - Seal val oY a 4 int Gs (S83 al Hi | Int bs 065 ! 4 i a 1 iFCatb>ed) fp 7 ae 1 system-oul- printto Crarb is grealer Than apap : 3 eT : 7} i I ; =I - |S H if | atb is greater Than 20 > ales | El i ad Nested _IF statement: it | Fn Nested af SkabemenE we Can declare = 1 |__| Statement in anether TF StaEement if ll >We can declare ane or maltiple TF Statements 1 | mamheres t 1 1 > Standard eyntax to declare Nested IF is- 1 Syntax - I TF Ccondition) { Statement CS sy a TF Condition) Stdtement Cs 3 i 5 al } ee ? Bxecttion Flow te Nike For @xecuting 4 ! ir condition there 16 q always need the outer @ scanned with OKEN Scanner car __ Coe) a | rte Condition is trae. —_———| >In Nested 1F JUM wil) check culer t¢ condition ie {t ts true then only HYhe inner FC Condition While Tu ynslead oF Nested IF condition. TP code After IF cod @ | Example. using Nested IF statement - Package Conditionalstak + puslic class NestedIF | public Static void main Cstring Clargs) { int age = 213 INE weight= as; 1F Cage >=\8) if CweighE>so) @ scanned with OKEN Scanner DATE Qe else stalement- | >In Java IF else Statement Vs also Used | the condition: | >It execiles a IF block iF Condition US ‘Brovidg Jin TF signatare As fae otherwise else Block eI] ement= I) — | exe cuted. = | yekandard syntax to Cleclare TF else stat Syntax - else gtatement Cs)5 TE Ceondition ) = | { oe | Statement Cs)s Ff et Lr | | iki False Tue 2 TF code *]) ise. code pip Lapa Ve Example using TF else statement: ——<———— I Attes IF I Q - q j a — Package ‘basicProgram 5 | i ublic class IFElse r ublic static Void main (String F7args) {At percentage = fo ; ie Cpercentage 265) ad anak @ scanned with OKEN Scanner te Qut pal - ~~ shee IE || —gystem: oul: printin ("Firat clave eee geo, 7 peal 1 7 - r FirsE class ; —ThyNested IF else Statement: este et nested iF else Statement fs Used | to Eest the condition . I >This Statement represents fhe (© else bloc | within TF else block. I > Here inner {fe block Condition executes weboly Jwhen ouler jr block condition is frge Otherwise 1k [executes Ehe else Statement, ] > Standard syntax cig.) j 7 sgatax- / | tF Ccondibion ) I ‘4 Statement Cs)3 5 | iP Ccondition) Statement Cs) 5 l l gay ) I else { ; | “Statement Cs) 5 @ scanned with OKEN Scanner A we y : & xamele USiNg Vested Gels] Gtakement = he ee = laches TE L & ackage Basic Program 3 public class Nestedicelse [ public tatic vaid main Cstring CI args) [ String Username = “NikiEa™ 5 String “Pass = "P@t4s49” Fe Cusername = " NikiEQ ae ig ie CPass = “ P@tGHaN") { « Syste God: prinkin C* Legio Successhal ") 5 1 —— else Nf a Gyatern: Oul- printtn C" Password is wrang ys | yt else { Gyslem dul printoo C“ Username is wreng”)5 @ scanned with OKEN Scanner g a = ~ Password ig Wrong 13. 7m at =| Et ayie_ else Slatewent= x >It is also called as iF elee iF Ladder kate med ia gr else IF statement. r SThis Skatemenk execules GAe condition pen multiple Statements § > Syntax to declare dF else TF Statement fs - | SyNtax -- + es (FP Ccondition 1) Skatement Cs)5 Et es Te Ccondition? f statement Cs) 5 a Ccondition 3) Statement Cs) 5 % =A else StqtementCs); @ scanned with OKEN Scanner

You might also like