Back to photostream

OOPs concepts in Java

Java is a programming language that is based on OOPs concepts (Object-oriented programming system). In other words, it uses objects to define the data and their behavior. This makes the code more flexible and increases the readability and helps to understand the code easier. In this tutorial, we will understand OOPs concepts in Java.

Characteristics of OOPs in Java

 

Advantages of OOPs Concepts in Java

 

- Reduces code redundancy

- Improves code readability

- Low development cost

- Improved software quality

- Faster product development

- Reusability of code

 

Challenges of OOPs in Java

 

- High learning curve

- Large program size

- Slow execution

 

Object

One of the important features of Object-oriented programming in Java is an object. An object represents a real-life entity which is an instance of a class. It contains both data and methods(behaviors). Objects have mainly 2 characteristics of state and behaviors. The state is nothing but an identity of the object(data) and behavior describes the function(method) of the object.

 

Example:

 

Object: Mobile

 

State: Name, Model No, Color

 

Behavior: Calling, messaging, switch on, switch off, take photos, etc.

 

Let's understand this with an example. Here class name is Mobile and it has attributes or states as mobilename, modelNumber, and color. In java programming, we call these attributes as variables and behaviors as methods.

 

The methods are call(), message(), switchOn() and switchOff().

 

www.tutorialcup.com/java/oops-concepts-in-java.htm

175 views
0 faves
0 comments
Uploaded on September 20, 2021