What is Object Oriented Programming in Java?


Object Oriented Programming

Java is an Object-Oriented Programming Language.Everything in JAVA is an Object.

Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behaviour.



Principles of Object-Oriented Programming

The object-oriented paradigm supports four major principles ,they are also known as four pillars of the object-oriented paradigm.

1.Encapsulation:

  • Wrapping data(variables) and methods(code acting on data) within classes in combination with implementation hiding (through access control) is often called encapsulation.
  • In java encapsulation can be achieved using classes.
  • Using this encapsulation we can provide security for the data inside a class using object reference, this is called ‘Data hiding’.

2.Abstraction:

  • Abstraction means hiding the implementation details from the user and gives only functionality details.
  • For example, when you drive your car you do not have to be concerned with the exact internal working of your car. What you are concerned with is interacting with your car via its interfaces like steering wheel, brake pedal, accelerator pedal etc. Here the knowledge you have of your car is abstract.
  • In java abstraction can be achieved using abstract class and interfaces.

3.Inheritance:

  • Inheritance in java is a mechanism in which one object acquires the properties and behaviors of parent object. It’s essentially creating parent-child relationship between classes. In java, you will use inheritance mainly for code re-usability and maintainability.
  • In java inheritance is also called as IS-A relation ship, and it can be achieved using “extends” key word.

4.Polymorphism:

  • The word polymorphism came from two greek words ‘poly’ meaning ‘many’ and ‘morphos’ meaning ‘forms'.
  • Polymorphism represents the ability to assume several different forms.
  • Polymorphism is the ability by which, we can create functions or reference variables which behaves differently in different programmatic context.
  • In java language, polymorphism is essentially considered into two versions:
    • Compile time polymorphism (static binding or method overloading)
    • Runtime polymorphism (dynamic binding or method overriding)

5.Class:

Collection of objects is called class. It is a logical entity. A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space.

6.Object:

Any entity that has state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical. An Object can be defined as an instance of a class. An object contains an address and takes up some space in memory. Objects can communicate without knowing the details of each other's data or code. The only necessary thing is the type of message accepted and the type of response returned by the objects.

Features of JAVA

There is given many features of java.They are also known as java buzzwords. The Java Features given below are simple and easy to understand.

About JAVA

Learn About JAVA and It's Origin
Java is an efficient powerful object-oriented language developed in the year of '1991'.




Comments

Popular posts from this blog

A Comprehensive Guide to Java and Its Applications: Exploring the Versatility of Java Programming

Variables of Java