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

Object Oriented Programming

The document discusses the key concepts of Object Oriented Programming (OOP) in Java including classes, objects, methods, pillars of OOP like abstraction, encapsulation, inheritance and polymorphism. It also covers method declaration components and message passing between objects.

Uploaded by

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

Object Oriented Programming

The document discusses the key concepts of Object Oriented Programming (OOP) in Java including classes, objects, methods, pillars of OOP like abstraction, encapsulation, inheritance and polymorphism. It also covers method declaration components and message passing between objects.

Uploaded by

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

Object Oriented Programming (OOPs) Concept

in Java
Read
Practice
Jobs



As the name suggests, Object-Oriented Programming or OOPs refers to languages
that use objects in programming, they use objects as a primary source to implement
what is to happen in the code. Objects are seen by the viewer or user, performing
tasks assigned by you. Object-oriented programming aims to implement real-world
entities like inheritance, hiding, polymorphism etc. in programming. The main aim
of OOP is to bind together the data and the functions that operate on them so that no
other part of the code can access this data except that function.

Let us discuss prerequisites by polishing concepts of method declaration and


message passing. Starting off with the method declaration, it consists of six
components:
 Access Modifier: Defines the access type of the method i.e. from where it
can be accessed in your application. In Java, there are 4 types of access
specifiers:
 public: Accessible in all classes in your application.
 protected: Accessible within the package in which it is defined
and in its subclass(es) (including subclasses declared outside
the package).
 private: Accessible only within the class in which it is defined.
 default (declared/defined without using any
modifier): Accessible within the same class and package within
which its class is defined.
 The return type: The data type of the value returned by the method or
void if it does not return a value.
 Method Name: The rules for field names apply to method names as well,
but the convention is a little different.
 Parameter list: Comma-separated list of the input parameters that are
defined, preceded by their data type, within the enclosed parentheses. If
there are no parameters, you must use empty parentheses ().
 Exception list: The exceptions you expect the method to throw. You can
specify these exception(s).
 Method body: It is the block of code, enclosed between braces, that you
need to execute to perform your intended operations.
Message Passing: Objects communicate with one another by sending and receiving
information to each other. A message for an object is a request for execution of a
procedure and therefore will invoke a function in the receiving object that generates
the desired results. Message passing involves specifying the name of the object, the
name of the function and the information to be sent.
Master OOP in Java Write cleaner, more modular, and reusable Java code by
building a foundation in object-oriented programming with Educative’s interactive
course Learn Object-Oriented Programming in Java. Sign up at Educative.io with
the code GEEKS10 to save 10% on your subscription.
Now that we have covered the basic prerequisites, we will move on to the 4 pillars of
OOPs which are as follows. But, let us start by learning about the different
characteristics of an Object-Oriented Programming Language.
OOPS concepts are as follows:
1. Class
2. Object
3. Method and method passing
4. Pillars of OOPs
 Abstraction
 Encapsulation
 Inheritance
 Polymorphism
 Compile-time polymorphism
 Runtime polymorphism

You might also like