Object-Oriented Programming (OOPs) concepts in Java helps in creating programs that are based on real world.
OOPs is very flexible and compatible and hence is the most used concept in developing larger applications.
The software application that are developed on the OOPs concepts at first analyze the program then prepare a solution, do the coding and then maintains it.
To understand the functionality of OOPs we must first understand the following:
Class: Class is a blueprint or template from which various objects can be created. It contains data and codes with behavior.
In Java, Class is a structure inside which a set of objects with common behavior, properties and identity exist.
In Java user can define their own classes using data and code.
Object: A real world entity is an object. Object has state and behavior. Objects are the basic unit of OOPs . They are useful in programming, as if a particular object creates a problem it can be replaced by different object in the application.
An object stores its state in fields/variables and exposes its behavior through methods/functions.
In terms of Class, Object is an instance of Class.
Inheritance: There are some features that are common in individual objects and OOPs allow classes to inherit some common behavior and state from each other. This helps the programmer, as he/she has to only develop the new features and use the existing features of old general class. This reduces the development time.
Abstraction: Abstraction in Java shows the essential features of the object that are relevant to the current perspective. This helps the programmer to focus on few and important object at a time. Abstract deals with interface.
Encapsulation: Encapsulation means wrapping up data and behavior of an object in a class. Encapsulation also hides any unnecessary data not required by an object and prohibits outsiders in seeing inside an object in which Abstraction is implemented.
Polymorphism: Polymorphism allows an object to simulate a specific behavior of other object. Programmer can treat one object like other and can create multiple level of interface.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: OOPs concepts in Java
Post your Comment