Java Programming
Topperworld.in
OOP’s Concept in Java
Object-oriented programming System(OOPs) is a programming
concept that is based on “objects”.
It allows users to create objects they want and create methods to
handle those objects.
The basic concept of OOPs is to create objects, re-use them
throughout the program, and manipulate these objects to get
results.
The main principles of object-oriented programming are abstraction,
encapsulation, inheritance, and polymorphism. These concepts aim to
implement real-world entities in programs.
List Of OOP’s Concept in Java
Object
Class
Abstraction
Inheritance
Polymorphism
Encapsulation
Java Programming
Object :
Any entity that has state and behavior is known as an
object. For example, a chair, pen, table, keyboard, bike, etc. It can be
physical or logical.
An Object can be defined as an instance of a class. An object contains an
address and takes up some space in memory.
Class :
Collection of objects is called class. It is a logical entity.
A class can also be defined as a blueprint from which you can create an
individual object. Class doesn't consume any space.
Inheritance :
Inheritance is a mechanism in which a new
class is derived from an existing class. The new class is called the
subclass, and the existing class is called the superclass. The subclass
inherits the properties and behavior of the superclass.
Java Programming
Polymorphism :
Polymorphism means the ability of an
object to take on many forms. In Java, polymorphism can be achieved
through method overloading and method overriding.
Abstraction :
Abstraction means hiding the implementation
details of a class and exposing only the necessary details to the user. In
Java, abstraction can be achieved through abstract classes and interfaces.
Encapsulation :
Encapsulation means wrapping up the data
and methods into a single unit. In Java, encapsulation can be achieved
through access modifiers such as private, protected, and public.
These concepts are the pillars of OOP’s in Java we will Discuss these
in Detail seperately.
Java Programming
Advantage of OOP’s in Java
There are various advantages of object-oriented programming.
OOP’s provide reusability to the code and extend the use of existing
classes.
In OOP’s, it is easy to maintain code as there are classes and
objects, which helps in making it easy to maintain rather than
restructuring.
It also helps in data hiding, keeping the data and information safe
from leaking or getting exposed.
Disadvantage of OOP’s in Java
The length of the programmes developed using OOP language is
much larger than the procedural approach. Since the programme
becomes larger in size, it requires more time to be executed that
leads to slower execution of the programme.
We can not apply OOP everywhere as it is not a universal language.
It is applied only when it is required. It is not suitable for all types
of problems.
Programmers need to have brilliant designing skill and programming
skill along with proper planning because using OOP is little bit
tricky.
OOP’s take time to get used to it. The thought process involved in
object-oriented programming may not be natural for some people.
Everything is treated as object in OO’P so before applying it we
need to have excellent thinking in terms of objects.
Java Programming
Benefits of OOPs in Java
The benefit of code reusability.
Easier to co-relate with the real-world.
Generation of a secured program.
Convenient to solve complex problems.
Easy to maintain the software complexity.
Multiple instances can be generated for an object.