Krivalar Tutorials 
Krivalar Tutorials

Java OOPS - Object oriented programming concepts


Hello World >


The concept of safeguarding or hiding the data from improper or accidental usage is called encapsulation.This is just like hiding the powdered medicine inside a capsule.

  • This is just like hiding the details of a car within a bonnet. To drive the car, all that the user needs to know is how to use the steering wheel, brake, accelerator, clutch and gear. A driver does not need to know what is inside the engine or what is inside the steering wheel.
  • If you are using a TV, all that you need to know is how to use the remote controls or manual controls and buttons on TV. You do not need to know what is inside the TV and that is encapsulated or hidden from you.
Encapsulation is supported in Java by use of private, public, protected or default keywords


The concept of reusing the data and activties from a parent entity is called inheritance.

  • Creating a hierarchy of inheritance like, C inheriting from B and B inhering from A is called Multi-level inheritance.
  • Inheriting from more than one parent entity is called Multiple inheritance. For example, A child can inherit its behaviour from Father and Mother.
Java supports only Multi-Level inheritance and does NOT support Multiple inheritance.


The concept of enabling reuse by extracting common information and behaviours from multiple entities and creating entities from the extrtacted information and behaviours. Inheritance is one form of Abstraction.

  • An example for abstraction is abstracting the common information of various types of account like Savings Account, Current Account and Fixed Deposit Account and putting that information in Generic entity named Account.


It is the ability of programming constructs to exist in different forms.

In Java, behaviours named as Java methods can exist with different method signatures.


Hello World >

Searching using Binary Search Tree