Object Oriented Programming is a technique to create programs using classes (logical representation of data) and objects (physical representation of data). In this approach, object interacts with other objects by sending messages. It provides a great flexibility, modularity, reusability and security to an application.

Java is an object oriented and class based programming language. It implements all the features of object oriented programming like.

1. Class
2. Object
3. Member
4. Abstraction
5. Encapsulation
6. Polymorphism
7. Inheritance

1. Class:

Class is a concept which encapsulates the members (variables and methods). It is a blue print of an object. Also you can     say a class is a logical representation of data.

2. Object:

Object is an instance of a class. Object gets created dynamically in the heap memory of JVM. You can access the variables and methods through objects in the class. The object can be created using new keyword.

3. Member:

The variables, methods and the nested class are the member of the class.

4. Abstraction:

Abstraction is the disclosure of necessary details of an object. So it can reduce the complexity and increase the efficiency.  For example, the driver of a car doesn’t think about the individual internal parts of a car. He can think about only the behaviour of the car. This abstraction helps to driver to drive the car without any overhead of complexity of the parts that forms the car. He doesn’t know how the engine, gear system or breaking system is working.

5. Encapsulation:

It is a mechanism that binds the code and the data together. It protects the code and data from outside misuse. For Example, A house has some furniture like beds, tables, chairs etc. Those are protected by the house and only accessible by owner of the house. Outside people can’t access that furniture.

6. Polymorphism:

Polymorphism is an ability to define more than one method with same name. In java polymorphism comes in two flavor, method overloading or static polymorphism and method overriding or dynamic polymorphism.

Method overloading is a process of defining two or more methods with the same name.The signature of the methods must be varied with respect to no or type or order of parameters.

Method overriding is a process of defining two or more methods with the same name with same signature.

7. Inheritance:

Inheritance is the process of creating a class based on another class. It gives us code reusability. For example, we extend a base class to a derived class. The derived class then inherits the properties of its base class.

Categories: Core Java

Post by

Sun Certified Java Programmer

Leave a Reply


Different ways to r

Different ways to reverse a String in java Here is [...]

Exception Handling i

1. What is Exception?         Exception is [...]

How to create an imm

Immutable Object: Object is created once and value of the [...]

StringBuffer and Str

StringBuffer: A thread-safe, mutable sequence of characters. A string buffer [...]

String handling in j

String handling in java In this topic we discuss about [...]

Different ways to r

Different ways to reverse a String in java Here is [...]

Exception Handling i

1. What is Exception?         Exception is [...]

How to create an imm

Immutable Object: Object is created once and value of the [...]

StringBuffer and Str

StringBuffer: A thread-safe, mutable sequence of characters. A string buffer [...]

String handling in j

String handling in java In this topic we discuss about [...]

Sponsors

  • Cheap reliable web hosting from WebHostingHub.com.
  • Domain name search and availability check by PCNames.com.
  • Website and logo design contests at DesignContest.com.
  • Reviews of the best cheap web hosting providers at WebHostingRating.com.