Java Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP) is a better way of solving computer problems compared to a procedural programming language such as Basic or C. OOP represents the concept of “Objects”. An object can be thought of as a self-contained bundle of behavior (code) and state (data). It’s a cleaner and more logical technique used to write code that is more reusable and maintainable.
Java is a great Object-Oriented Language and as stood the test of time and used for many processing task.There are other OO languages like C++, Objective C, SmallTalk, Perl, Python that provide the above OO aspects, completely or not pure OO language. Java from the ground up is a fully OO language. All base implementation in java is object even the primitive data types can also be converted into object by using the wrapper class.

To be an Object Oriented language, any language must follow at least the four characteristics: Abstraction, Encapsulation, Inheritance and Polymorphism.

Data Abstraction:
Abstraction is a view or representation of an actual item. It is essential properties and actions of an object we are representing. It denotes the essential characteristics of an object that distinguish it from all other kinds of objects. It is a logical boundary around behaviors (methods) and data (properties) they work.

Encapsulation:
In encapsulation representation of data and the implementation details are hidden. The internal workings are hidden, but access is provided via the interfaces – methods. Encapsulation and abstraction are related. Abstraction is more a logical view, while encapsulation is closely related to the physical implementation. Encapsulation, abstracts, hides access to the data and methods are used to access the data. It protects the data via interface implementations. /p>

Inheritance: It allows code reuse. We define a base class, the super class. New classes use the super lass code. The super class is extended, we do not copy and paste existing code but reuse it.

Polymorphism: From the base class, we can create more types of it. Polymorphism is the way of providing the different functionality base on the base class. Polymorphism means multiple form.

Dynamic Binding: This too is related to OO principles. The relationship between the base and sub class can be numerous at runtime. There is a difference in the code we create and how the code gets used at runtime. Usage can be more dynamic than anticipated. The sub classes can be used or related in different ways. Dynamic binding automatically determines which sub class of the base class is used. It’s a safer mechanism to associate and relate code.