You are on page 1of 3

OOP

OOP - Inheritance, Polymorphism, Abstraction, Encapsulation

Inheritance: Extending a class(Parent class -> Child Class)

Polymorphism: one method works in various ways/forms.


Static/compile time(overloading), dynamic/run time(overriding).
Method overloading - name same, different parameters, output new info
Method overriding - name same, override parent's method and run child's method, output
updated version of prev info.

Abstraction: only show the important parts


Implemented by interfaces(declared methods are by default abstract) and abstract class

Encapsulation: making data hidden. Only methods of that class can access.
Implemented through private variables. Methods of other classes can access it but getter-setter

In Java, multiple inheritance is impossible in case of classes(extends) but possible for abstract
classes and interfaces(implements).
2 parent of one class is invalid, 2 child of one class is valid.

Array:
Values are stored sequentially.
One single node contains only one element.

Linked List:
Values are not stored sequentially.
One single node contains an element and the memory location address of the next node. That
is how nodes of a linked list are linked with each other.

LinkedList<String> lList = new LinkedList<String>();

lList.add("Geeks");
lList.add("Geeks");
lList.addFirst("First");
lList.addLast("Last");
lList.add(1, "For"); //(index number, element)

for (int i = 0; i < lList.size(); i++) {


System.out.print(lList.get(i) + " ");
}
Recursion VS Loop
Recursion is memory costly
Loop is memory efficient
public class RecursionExample {

static int factorial(int n){

if (n == 1)

return 1;

else

return(n * factorial(n-1));

public static void main(String[] args) {

System.out.println("Factorial of 5 is: "+factorial(5));

JDK = Java Development Kit, it consists of JRE (Java Runtime Environment) to execute
programs and another environment that helps users to develop their java program.
JVM = Java Virtual Machine, part of JRE and acts as a run time engine to run java applications.

CSI Model:
CSI stands for Continual Service Improvement.
Involves 6 steps:
1. What is the Vision? -> Business Vision, Mission, Goals and Objectives
2. Where are we Now? -> Baseline Assessment
3. Where do we want to be? -> Measurable Targets
4. How do we get there? -> Service and Process Improvement
5. Did we get there? -> Measurements and Metrics
6. How do we keep the momentum going? -> To keep going back to Step 1 until finished.

You might also like