OOps Concept in Java

Posted By : Manish Kumar | 29-Sep-2017

OOPS (Object Oriented programming) is a conceptual programming strategy that is associated with the Classes and Objects and in that various other concepts are used like InheritancePolymorphismAbstractionEncapsulation etc.

Briefing this concept for a basic knowledge is as below:

1) Abstraction: Abstraction is the strategy in which a developer performs the action with the help of subclasses but do not shows the internal actions, this strategy has only declaration part but implementation part is missing.

2) Encapsulation: Encapsulation is a technique, by using which developers performs the abstraction and for doing this, Java provides some access modifiers which helps the user to bound the elements in different scopes and those modifiers are Private, Public, Package, and Default. 

Where Private, Public and Package are used as keywords and for default is already taken as by-default

Polymorphism: If a user/developer need an object to be behaving differently at different times so he/she uses java technique polymorphism, which means one name but different forms.

Also, it is divided into two parts: 1) Compile time polymorphism    and     2) Run time polymorphism

1) Compile time polymorphism is achieved by using method overloading concept and user just need to change the arguments and the method name is same.

2) Run time polymorphism is achieved by using method overloading only, but the difference is that, that the actual implementation and that class is decided at runtime only.  The compiler cannot track that which class will be invoked for implementation of next steps.

Due to this, run time polymorphism is also called Dynamic Method Dispatch in other languages.

Inheritance: This OOPs technique in java introduces a concept of copying and inheriting elements and methods from the parent class, where parent class is named as superclass and child class is called as the subclass in JAVA.

In this, we use "extends" keyword followed by parent class name.

Other OOP's concepts are Association, Aggregation, and composition.

Thanks !

 

About Author

Author Image
Manish Kumar

Manish is Adaptive and passionate to learn new technical skills, have knowledge of testing and love to play badminton in free time

Request for Proposal

Name is required

Comment is required

Sending message..