0% found this document useful (0 votes)
123 views

Java OOPs Concepts

This document discusses key concepts in Java object-oriented programming (OOP), including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It defines objects as real-world entities with state and behavior. Classes are collections of similar objects. Inheritance allows objects to acquire properties of parent objects. Polymorphism allows one task to be performed in different ways. Abstraction hides internal details and shows functionality. Encapsulation binds code and data into single units, providing data hiding. OOP makes development and maintenance easier compared to procedural programming.

Uploaded by

manohar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Java OOPs Concepts

This document discusses key concepts in Java object-oriented programming (OOP), including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It defines objects as real-world entities with state and behavior. Classes are collections of similar objects. Inheritance allows objects to acquire properties of parent objects. Polymorphism allows one task to be performed in different ways. Abstraction hides internal details and shows functionality. Encapsulation binds code and data into single units, providing data hiding. OOP makes development and maintenance easier compared to procedural programming.

Uploaded by

manohar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Java OOPs Concepts

Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a
methodology or paradigm to design a program using classes and objects. It simplifies the software development
and maintenance by providing some concepts:

 Object
 Class
 Inheritance
 Polymorphism
 Abstraction
 Encapsulation

OBJECT

Objects are the basic run time entities of Object-Oriented System. Object may represent a person, a place, a bank account,
a table etc… Any entity that has state and behavior is known as an object. For Example : state of a Person are
color, height, weight etc. And behavior of a person includes speaking, Walking etc.. since Person has both state
and behavior so, it is an example of Object. Object can be physical and logical.

In Java , Object is an instance of class.

CLASS

Class is a collection of objects with similar type . For example: Collection of mango, orange, grapes is called
Fruits class and similarly collection of bike, bicycle, car, bus comes under Vehicle Class.
In Java, a class contains data and code to manipulate that data. It is a Logical entity

DATA ABSTRACTION & ENCAPSULATION

Abstraction refers to the set of representing essential features without including the background knowledge. (or)
In short, Hiding internal details and showing functionality is known as Abstraction. For Example :

After identifying the internal details of the functionality ,it is necessary to wrap the required data and methods
that manipulate the data. Such Wrapping up of data and methods into a single unit is known as Encapsulation.
The data is not accessible to the outside world and only those methods, which are wrapped in the class, can
access it. These methods provide the interface between the object’s data and the program. This insulation of the
data from direct access by the program is called Data Hiding.
In Java, Classes are used to achieve Encapsulation.

INHERITANCE

When one object acquires all the properties and behaviors of parent object i.e. known as inheritance.
Inheritance supports the concept of hierarchical classification.For Example, the bird robin is a part of the class
flying bird, which is again a part of the class bird.the principle behind this is that each derived class shares
common characteristics with the class from which it is derived. In oop, the concept of inheritance provides the
idea of reusability

It provides code reusability.

Runtime polymorphism.

Polymorphism

When one task is performed by different ways i.e. known as polymorphism. For example: to convense the
customer differently, to draw something e.g. shape or rectangle etc.

Another example can be to speak something e.g. cat speaks meaw, dog barks woof etc.

In java, we use method overloading and method overriding to achieve polymorphism

Abstraction

Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't
know the internal processing.

Encapsulation
Binding (or wrapping) code and data together into a single unit is known as encapsulation . For example:
capsule, it is wrapped with different medicines.

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

Advantage of OOPs over Procedure-oriented programming language

1)OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is
not easy to manage if code grows as project size grows.
2)OOPs provides data hiding whereas in Procedure-oriented prgramming language a global data can be accessed
from anywhere.
3)OOPs provides ability to simulate real-world event much more effectively. We can provide the solution of real
word problem if we are using the Object-Oriented Programming language.

What is difference between object-oriented programming language and object-based


programming language?

Object based programming language follows all the features of OOPs except Inheritance. JavaScript and
VBScript are examples of object based programming languages.

You might also like