You are on page 1of 2

Oops: It is an Object oriented programming system. It relies on the concept of classes and objects.

It
is Used for code reusability and simplifies the code.
Abstraction:
● Abstraction is a property that hides internal details and shows functionalities.
Ex: Take real life example cars, A man only knows by pressing the accelerator increases the
speed, by applying brakes stops the car. But users don't know about internal implementation.
● It is achieved through Abstract classes and Interfaces
● Abstract classes can have abstract methods and normal methods.
● Abstract classes have final and non final variables.
INTERFACE
Interface is a method to achieve abstraction.
● It has only abstract methods no - body.
● Multiple inheritance and abstraction is achieved through interface concepts in java.
Abstract Interface
Subclasses extends abstract class subclasses implements interfaces
Abstract class can have 0 or more abstract methods Interfaces can have default and static
methods
We can extend only one abstract class we can implement multiple interfaces

POLYMORPHISM
Polymorphism means different forms. It is performing a single action in diff erent ways.
In java there are two types of polymorphisms.
1.STATIC Polymorphism (Compile Time Polymorphism)
It can be achieved by method overloading.
When there are multiple functions with same names by different parameters/number of parameters then
they are called method overloaded.
2.DYNAMIC Polymorphism(RunTime Polymorphism)
It can be achieved by method overriding.
When there are multiple functions with same names and same parameters then they are called method
overridden.
ENCAPSULATION (Combination of DATA HIDING + Abstraction)
Encapsulation is wrapping up data into a single unit. Keeping our original data private and binding data
with methods. Access data by two methods: Getters and setters.
Abstraction Encapsulation
We can implement abstraction using It can Implement using access modifiers
abstract methods And interfaces i.e., Private,protected,public
Implementation hidden using abstract Data hidden using getters and setters
Classes and interfaces
INHERITANCE
It is a main pillar in OOPS concepts. A super class can inherit the features of the other sub class using
inheritance.
Super Class: A class whose properties are inherited .
Sub Class : A class which inherits properties i.e extends the properties of super class.

Access modifiers:
PUBLIC - accessible everywhere(within & outside class,within & outside package)
PRIVATE - accessible only within class
PROTECTED - within class and package and outside class with help of child class
DEFAULT - only within package

Exception:
An exception is an event that an application might try to catch during execution.
So we have to handle exceptions.
Try - to get exception
Catch - to throws exception
Finally - to print even we get exception

Multithreading
Executes two or more threads concurrently. To use the complete power of the cpu.
Thread: Unit of process.
MultiThreading: Sub process that runs concurrently . take less time to terminate.
Process: Program is in execution. Takes more time to terminate

Threads with inheritance :


Class extends thread : When we extend thread class ,
● we can’t extend any other class even if we require it.
Class implements runnable : when we implement runnable we need run() methods.
● we can save space for our class to extend any other class in future. It shares objects to multiple
threads.
Collections:
Collections:classes || collection:Interface
Collection of elements and objects
● We use collection if no.of size is not fixed then we use collection interface
Comparator interface : it compares 2 or more values like first,middle,last elements and execute
sort,reverse,....etc.,
Comparable interface: It compares its instances and compares itself with another object .
Set: No order and to be avoid duplicate(unsorted data but unique)
Hashset: If there are unique values and no duplicate values. we use hashset
Treeset: We use treeset to get in sorted format.
List : If duplicate and fixed sequence we use list(sorted but duplicate values)
Map : No repeated values accepted
HashMap: (Key,value) (Key -> No duplicate keys, Value -> can be duplicate)
Generics:
Generics means parameterized types and we use specific data types.
● Using generics we can implement algorithms that work on collections in different types.
Ex: ArrayList<Integer> value = new ArrayList<>();

You might also like