Java
Java
Java
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
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: