Introduction to OOPs in java

In this page, we will learn about basics of OOPs. Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc.


Object Oriented Programming System (OOPs)

Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behaviour. Object-oriented programming(OOPs) is a methodology that simplify software development and maintenance by providing some rules. Basic concepts of OOPs are:

  class

  Object

  Abstraction

  Encapsulation

  Data Hiding

  Polymorphism

  Inheritance

Class

Class is a blueprint of an object which have certain properties and behavior. Class is template defined so that we can create the object of this class type.

Object

Object is a real world entity which have properties and behavior. Real world entity means we can use the properties and behavior of an Object .
for example : laptop, pc, table, pen ,chair etc.

  All the things to which we can touch and feel is an Object.

Abstraction

Hiding the internal implementation and highlighting the set of services/functionality is called Abstraction .

  Example : Bank ATM Screens (Hiding their internal implementation and highlighting set of services like withdraw, money transfer, mobile registration).

  In java, we use abstract class and interface to achieve abstraction.

Encapsulation

The process of binding(or wrapping) the data and the code into a single unit is called Encapsulation .

  Every Java class is the example of encapsulation . Java bean is the fully encapsulated class because all the data members are private here.

Data Hiding

Hiding of the data from the outside person so that outside person can not access the data directly. This process is know as Data Hiding .

By using private modifiers we can implement the data hiding in our Java Class.

example


class Account
{
private double salary=40000.00 ;
}

Polymorphism

Polymorphism is one of the OOPs feature that allows us to perform a single action in different ways .
example : Draw something e.g. shape or rectangle.

Inheritance

Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. It is one of the fundamental features of object-oriented programming.
Read More

woman avatar