Java - Core Java - OOP’S Principal

OOP’S Principal

  • Class
  • Object
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message Passing
1 Class
Any JAVA program if we want to develop then that should be developed with respective to class only, i.e. without class there is no java program. “A class is a way of binding the data and associated methods in a single unit”. Here class is a keyword which is use for developing or creating user defined datatypes and represents logical representation of things.
2. Object
Think of an object as a fancy variable; it stores data, but you can “make requests” to that object, asking it to perform operations on itself. In order to store the data for the data members of the class, we must create an object. By using object we can access data member and member methods of class.
3. Abstraction
Abstraction is a process to show only essential thing and hide the complexity of system this abstraction is used for achieving the concept of user friendly. An essential element of object-oriented programming is abstraction. Humans manage complexity through abstraction. For example, people do not think of a car as a set of tens of thousands of individual parts. They think of it as a well-defined object with its own unique behavior. This abstraction allows people to use a car to drive to the grocery store without being overwhelmed by the complexity of the parts that form the car. They can ignore the details of how the engine, transmission, and braking systems work. Instead they are free to utilize the object as a whole.
4. Encapsulation
Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. One way to think about encapsulation is as a protective wrapper that prevents the code and data from being arbitrarily accessed by other code defined outside the wrapper. Data encapsulation is basically used for achieving data or information hiding i.e security.
5. Inheritance
Inheritance is the process by which one object acquires the properties of another object. This is important because it supports the concept of hierarchical classification. Inheritance is the process of taking features from one class to another class. The class which is giving the features is known as Base or parent class. The class which is taking the features is known as derived, child or sub class.
6. Polymorphism
Polymorphism is the process of representing one form in many forms. For example ’ +’ operator when apply on integer type of data then plus operator produce addition of two number i.e. sum and when we apply plus operator on string then we get concatenate of two string. We have two types of polymorphism. First compile time polymorphism and second is run time polymorphism.

Example - Suppose if you are in class room that time you behave like a student, when you are in market at that time you behave like a customer, when you at your home at that time you behave like a son or daughter, Here one person present in different-different behaviors.

7. Dynamic Binding
Dynamic binding is a mechanism of binding an appropriate version of a derived class which is inherited from base class with base class object.
8. Message Passing
Exchanging the data between multiple object is called as message passing i.e when multiple object sending or receiving the data is called as message passing.
Is java pure object oriented programming language?
Java is not considered as pure object oriented programming language because several object oriented programming features are not satisfied by Java (Like operator overloading and multiple inheritance). We are depending on primitive datatypes which are non objects