Docsity

java programming for junior developers, Summaries of Computer science

Partial preview of the text

Download java programming for junior developers and more Summaries Computer science in PDF only on Docsity!

Summary dava oop C adel Ori ealed thon aang) Caney ts Class Ablueprint or template for creating objects. Object An instance of a class. ie) bject- Encapsulation Protects data from direct access Oriented Programming Abstraction Hides unnecessary details Polymorphism Allows the same method to behave differently Inheritence Reuses code from existing classes LU nheritance => Allows on6 cltss to acgure Me Fulds add memyds yF asoher class using the 6X Heads kegnot J ~> the class bony wherited 15 called Me Super Class and he taker ting class 5 MG subclass >A Subclass un yse esl Fea buns ob ha super Lless and also add ils Odn Super keyword in Java = Mt Supt keyed in ava (5 used ty rele bo he imme Recap notes Page 1 > IMG Sup Huge In JAVA US Used ty FEF Fo MG Mme diate parent cless oh ot un an nhe rilana hig ea rdhy => ib allows a Sudglass bo ox plia Fly access pareat Class mombel kes fy art hiddea of overt i ddes. » Used bo call pareat cess Oongheygters ai sup l) _ Holy access parent Class mied sand variables hen puurr der or hidden @ You of Super with Varudles /f Base class vehicle class Vehicle { int maxSpeed = 120; } // sub class Car extending vehicle class Car extends Vehicle { int maxSpeed = 18@3 void display() // print maxSpeed from the vehicle class Y/ using super System. out.printIn("Maximum Speed: * + super.maxSpeed); } } // Driver Program class Test { public static void main(String[] args) { Car small = new Car()5 small.display(); } } Output Maximum Speed: 12@ Recap notes Page 2 Calle chuns dave Calledions proudé & Framiwork for sla inl ma nig lata gies of oly oth OFF cuea th O List lalorug => Tt % usd ( shyt or dertd collection where duplicates an Alluwtd and olomeae cn fo Accessed by heir ind ex Syalax List 2 Tye > list = new Artay bist K yee? C); Dodaralion public iter hus List LE > extends Syyened llltchon E> -C & @ sel Ine fue > Tt represents 4 wilachon sk vague olemend , meaning tL does py allow ov plicale valves Syale x StH < Wyse > seb =z ow shoot cy (); be doer Li on public mlertace sel Zep extends Gilledion ce > Lambda Ex pressions > Tes enable wessia ode 45 pumeles of assigning hy varia bles p resillin Nn Cltanet and Moye rea dab lo 044M S Sy Abax C patamtlers) > oC mulls ple statements oe Ex mple interface Add{ int addition(int a, int b); } public class GFGf public static void main(String[] args){ // Lambda expression to add two numbers Add add = (a, b) -> a + b; int result = add.addition(19, 28); System.out.printin("Sum: " + result); Recap notes Page 5