Object Oriented Programming (OOPs) concepts In Java, The Ultimate Guide

Object Oriented Programming (OOPs) concepts In Java

Step 1: Write the source codes (.java) using a programming text editor (such as Notepad++, Textpad, Gedit,IDE,Eclipse)

Step 2: Compile the source codes (.java) into Java portable bytecode (.class) using the JDK compiler (“javac“).

Step 3: Run the compiled bytecode (.class) with the input to produce the desired output, using the Java Runtime

(“java“).

Object  : –

OOPs-concepts-Object-Class

Object is a bundle of related variables and functions .

Objects share two characteristics: They have State and Behavior.
State: State is a well-defined condition of an item. A state captures the relevant aspects of an object
Behavior: Behavior is the observable effects of an operation or event,

Examples:
Object: House
State: Current Location, Color, Area of House etc
Behavior: Close/Open main door.

In Java, and in all object orientated programming languages, a class defines an object. An object is a self-contained item that interacts with other objects.

OOP/OOPS Concept – OOP is nothing but Object Oriented Programming/Paradigm .Object-oriented programming (OOP) is a programming paradigm that uses “objects” and their interactions to design applications and computer programs.

OOPs have following features : –

Object-oriented-programming-features

1 – Object-Instance of class / Run-time Entity

2 – Class- Blue-print / collection of Object

3 – encapsulation – Wrapping up of data and functions into single unit

4 – polymorphism – Different behaviors at different instances

5 – abstraction – Hiding our irrelevance data

6 – inheritance – querying the property from derived class to base class

1 – Object-Instance of class / Run-time Entity:

Object -Basically an object is anything that is identifiable as a single material .You can see around and find many objects like Camera, Monitor, Laptop etc. In OOP perspective, an object is nothing but an instance of a class that contains real values instead of variables.

An object is a particular instance of a class which has actual existence and there can be many objects (or instances) for a class. Class can be considered as the blueprint or a template for an object and describes the properties and behavior of that object, but without any actual existence.

2 – Class- Blue-print / collection of Object

Class- A class is a template definition of the methods and variables for a particular kind of object. In other words, class is the blueprint from which individual objects are created.

3 – Encapsulation – Wrapping up of data and functions into single unit

Encapsulation – Encapsulation is the process of wrapping up of data and behavior of an object into a single unit.

4 – Polymorphism – Different behaviors at different instances

The word polymorphism comes from Greek and means having several different forms. This is one of the essential concepts of object-oriented programming. Polymorphism occurs when a parent class reference is used to refer to a child class object.

5 – Abstraction – Hiding our irrelevance data

Abstraction -Abstraction in Object Oriented Programming refers to the ability to make a class abstract.Abstraction captures only those details about an object that are relevant to the current perspective, so that the programmer can focus on a few concepts at a time.

6 – Inheritance – querying the property from derived class to base class

Inheritance -Inheritance is the ability to define a new class or object that inherits the behavior and its functionality of an existing class. The new class or object is called a child or subclass or derived class while the original class is called parent or base class.

 Object Oriented Programming (OOPs) combines with  :-
a) Data
b) Instructions for processing that data into a self-sufficient ‘object’ that can be used within a program or in other programs.

Advantages : –

a) Objects are modeled on real world entities.

b) This enables modeling complex systems of the real world into manageable software solutions.

4 Comments

  1. DetectiveProfessor April 29, 2016
    • Kamal Thakur April 30, 2016
  2. Jayant Yadav April 30, 2016
    • Kamal Thakur May 5, 2016