Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
9 views
Java A1
Uploaded by
Rishab Jain
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save javaA1 For Later
Download
Save
Save javaA1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
9 views
Java A1
Uploaded by
Rishab Jain
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save javaA1 For Later
Carousel Previous
Carousel Next
Save
Save javaA1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 15
Search
Fullscreen
QOP Sava Asvawses' af 4] Explain Javea buzzurords ? cae Fave. Rater rany Cloguage "SY Varro nny aa tand and C Many complicated | wacture: poiniers , operator overloatiing , sty “ have beco 1, One of the most usetal features is -the garbage Dy it mokes (eval toca Signs Secures Tava is said-t0 be move secure programming mlers concer doesnot have p " yshieb 1 be embedde ‘applet’ the applet i> j< of computer, urbicl keep: trke vases and Unathorized acce: Portable: Portability is on) atures of j ushich enables the java pro glen. fer example, an applet deve ox operating sy cpus a wide variety of using Java rw and browsers connected to sthe intemet, Rigject Qdented Javea is sald te bea ed progranming tanguage. The primitive implemented as, objects using wrappe’ classes ‘ a t+ allows primitive dala types 4 perforant a code Robust: more Yoloust bec eee > executed ana variety of env Java is me 00g memory management y typed language, it has a strong[ade pent Java anywhere, any Hime jforever't des Jum CJava | Machine) 40 arehivg Povo independent. “The JVM ealed using one operating operating sysier - ithe Tava provi lavebitecture -natwral oF plat lailews the java progyam or on any Sag Can be eveented Multi toreaded © Mulls Oia Java supports mu Lyi threading ulkple operations urbich allows | siroultaneos ly: preqer i is usrile progvams that do Holerpyeled Java enables the creation of Gross platto: nee programs by caropiling into an Intermediate vepve sentation called Tava bylecore. The byte code is interpreted to any Pine on eh batve roc aiaas de so-that Tava provides high performance Dues like Tv, interpretation, machine co High Performance! A Rs CA eg with the help of fe and its steop Weity. Dictyibuled Tava Programming language Supports “Te P/ 1p protocols whieh enables te fava to Support Hthe distibuled enviooment of tHe internet Java alo Suports Romole Method Dnvecatior (Rm), this featu > ected enable: a program 4o invoke Method acrwss a network. Byoamlcr Tava is saidte be dynamic becau Lyte cede moy be dynamically updated on a ties ‘| systemand tt has a dyaamic memory — deatlocatto> (obj ects and garleage collector). Ba ilain briefly about Shing clas ani disa eed io Sting class With evample ? rtorring is a predefined class in java. * Ht can be declared as String mYyshing = "this is onkefssignment” the string class. te “There ave Several predefined methods + boolean equals (string objects) — used to check the eqpality of tuse stings e int length Oo = Returns the length of the shing 2 aha CharAt ( tet index) 2 To know specitié Characters in a Sting Progrars class Shing Ex f public stabe void main (String argst3) f Shing 4itle = “String Example” s Sting lamp= “ cyck"+ System oul printinC” Length of tHe” + titte lengthO): System. oul -printie( “charst index a" 4 HHHe CharAt(3)); if (Lite equals (tam py) System. ou. pinto ("They ave equal’ ele Sistem oul pricy € “They ae nol equal), ’ Y qutpass Length of tHe + 14 Seas index 3s i ia - they ove not 2qualWeare oreronding Jove 7 Define “a tat have same nameand diferea iP num b | Parameters and type of parameters 2 feeling th 2 Same for two ormore meee itis possible § distingutshed by payomerers methods and that co? b¢ pe of parameters. declaration and ty peed Oodaicg f ass is Beeeme thos is said to 62 overt Proce Me sctnnd overioading » is, 0pe of the oe ae of implementing polymorphism. + The veturn type alone is insu RPncre nt tone cites the Same method multiple times. Method 4> Changing the number of parameles. class Addition £ int add Cinta, iot b) Tint sum= ark: yeturn Sum) x jot add Cinta, inthy jot OD 4 PRieesuten = a4 b+ CY veturo sure} Class Graf public State Vord main ( String argsty)t Addthon ob = new Addition), int sums = Ob-addCt,2)! System. out: printto (“sur of the tun integer value! ook ie aPalaCuaye yh pie System. oud - printin( “eum eines integer Tre + su02), q Ef Sur of tum integers value. % Sum of three integers value : 6. Method» Changing Data Types of ea class product ¢ Public tot Proll Cinta, nth, inteds tot prodt -ax bac, Yeturn prod + i Public double Pod (double a, doutle b, double c) E double prod2 -arb*c> veluen prods; ei a elas Gra ft publi static Void main Product obj =netw Producto: int prodt = obj- Prod (1,2, 39; System. out -printin (" Product of the three integers “+P double prodga = obj- Prd Ct-0, 2.013 °%5 System
\ aaa bey J \ eye 2 t= 1°” obj-b + = 20 \ \| class Maio f : void main ( String GI args) i pject= new Cali ByRe ference Cto, 20)! ChValue of ar epbject a+ "a b's object iby i objechb)> \ of OF 2om bo. 40“ Whats is ‘static = Static Koy wor dy-The stake ea eot: Jused for memory manage fe varia Seticd to share the sa elase.the users can ap} and nested ctasses methods ,blacks » belongs to-the class than 0° in: [state keyword is user [that is the same Pe “the static keyword | epplicate fev the following 14. Blocks 2. Variables | I | | {| | | i | || | | \ | | ply stake st | Por a cons Per every insta is a nen-acce nar class Student § Stving name > int yollNo 3 stalic Shing altgName> stabic int counter = 07 public Student( Sting name> Bera eenaine|s, name; this. roliNo = set RotINo ©) % i state int #set RolINoO . counter ++) veturn counters ci Stoic wid setcllg (Sting Void get Stud erttofoO 5 Feo yrr ? Explaie the st 3, Methods the concept ust pad in oe ic mainly ate Koywrord in ee or method of a Blan oor dS with variables > the steke poyurord The a method ble 23 of the class yadable oF ane tant nee of a Class Bier in Tava that is ss modi 4. Clasces. ame) { clignamé = name; }Stern oud: printin C" voilNe #4 this. volINo ‘System. oul. prints CM Clg Names" + elignlameds t + [public class Static Demo f public Static void mae ( Shinglt args) Student -setcllgC" xyz." 9; Student $4 = new Student ("Aico"): Student s2 = new Shident C" Bob"): SA «get Studenttfo 03 $2. get Studenttnto 0; ? Qutub | name: Alice | rote 4 | cllgName: xyz “name » Bob yolINo + 2 cligName: xyz Usit2 WR Explain the process of defining and creating a package with suitable examples ? Package in Tava is a mechanism to encapsulate a group of classes. sub- packages , and interfaces. €Hl Wwe needto do is pat velaled classes into Packages. After that, te can stwply wrife an importelass Prom existing packages. and use it Jreep oP vet | cur program, 4 Package ia container ofa4 sp oun onok Duron "nef 20}49 shi) euuwrg mau ohw 220002 > wou pron 2421S 2a jag S012 aot yodust ate Bums sw gens odors Age Buss =o you, vpncqquonen oud P tba eee =P Goa pron 24045 20904 ay 35019 4 A ) eee ino ar SBS pouyaw 9e) tee een 22a Besant > aq wee vadns + SP SHOE wo abeea Jo2sn ap. st 1Sroe : sghiet the Us € Baal Keyword io java ured 40 ves a a can Waricitle 2 “ context jerused t.” J pderh ed Becee i rol a jove Ee iFinat car be 4 the Pmal Keywrr Peeeicayiauie that have 9° value pied with the variables a a can bE OP ank final 50 initializot be ib ic called bl Weed final variable. F oe bank final in the static block oy uninifia ye can Vowiatle Hin the constructay onty. “The be inttialtzed vaviak Static also which will | only. tae wat! ave detailed. teaarng of thane. ket | Pinal class stud f | Seb b Clas: books extends stud Void Show) f Ss ‘ y stem. out: printto( "Bovle~ Class methoal")+ % public static otd main (String argstI)s | bovks BA = neo books 0): B1. Shows eryoy Cannot inher art Prom Final stuct clay b Stud § Claw books extend}in the diterent types oP acer aroabos pla ‘herent ty pes of accone specifiers with amples. Aiccess speciPiers are -the koyurmds Uke * public"; TProteclea”, "olefautt" and "privale” uric has its Spectel meaning ts java, it definas the access SSPE BEES rs ctncds and. clases and here the Pcres’ Scape means the area oy space urbere a variable! m& classes oF methods are accessible. >; pablic access speci fiers: +The access scope of the “public” is everyurhere tike im all
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6125)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brené Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Tóibín
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2530)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel