OOPs concepts in Java

Topics under OOPs (Object oriented programming language)

  • Class
  • Object
  • Data hiding
  • Abstraction
  • Encapsulation
  • Tightly Encapsulated class
  • Is-A relationship/Has-A relationship
  • Method signature
  • Overloading
  • Overriding
  • Constructor
  • Polymorphism

Class and Object

Consider to build an building we first need a plan on paper. This plan can be called as “Class”. And the actual build buildings are can be called as Objects. So we can say Class is an template of an object and Object is an template of a class.

Data Hiding

Data hiding is a process of hiding a own data from other users. This Data hiding can be done by Private access specifier in java. Make data member/variables as private.
Advantage: Security
Eg: You can access only your account data details in bank. You can’t access other users account data.


Abstraction is hiding internal implementation and just highlight thing those we are offering. Abstraction can be done by Abstract classes.
Advantage: Security, Maintenance of application.


Binding data members and corresponding method(behavior) into single unit.
Eg: Class
Advantage: Security
Disadvantage: Slow down application

Tightly Encapsulated class

A is said to be Tightly Encapsulated class if each and every variable is declared as Private whether geter() and seter() method set as Public or not, no need to check.

Is-A relationship/Has-A relationship

Is-A relationship is also known as Inheritance. This can be implemented by “extend” keyword.
Advantage: Re-usability of a code

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.