What is OOP?


Object-Oriented Programming
What is OOP?

The course is part of this learning path

What is OOP?
1h 27m

In this course, we will learn the concepts of microservice and spring framework with a focus on object-oriented programming.

Learning Objectives

  • Object-oriented programming in Java

Intended Audience

  • Beginner Java developers
  • Java developers interested in learning how to Build and Deploy RESTful Web Services
  • Java Developers who want to develop web applications using the Spring framework
  • Java Developers who want to develop web applications with microservices
  • Java Developers who wish to develop Spring Boot Microservices with Spring Cloud


  • Basic Java knowledge

Hello there, my friends. In this section, we will learn the object-oriented concept. Let's start. What is OOP?

Object and Class. Object-Oriented Programming, OOP, is a method of designing and implementing software. The primary purpose of Object-Oriented Programming is to increase the flexibility and maintainability of programs. It simplifies software development and maintenance by providing some concepts. These concepts are object, class, inheritance, polymorphism, abstraction, and encapsulation. We will cover these subjects in detail in this course. Let's start with the object-oriented concept. Object and Class. A class is a group of similar entities. An object can be defined as an instance of a class. Objects are often used to model real-world objects you find in everyday life.

A Java object is a self-contained component which consists of methods and properties. An object contains an address and takes up some space in memory, but a class doesn't consume any memory space. Objects have three characteristics: state, behavior, and identity. Now, let's try to understand these characteristics in the next slide. Characteristics of Objects. An object has three characteristics. It has state, behavior, and identity. The state represents the data of an object. Behavior represents the action of an object, such as start, stop, etc. Identity is used internally by the Java virtual machine to identify each object uniquely. The value of the ID is not visible to the external user. Consider a car. Its name is Ferrari. Its color is red. And the model is 2015. These are its state. This car starts and stops, so starting and stopping are its behavior. Object and Class Example. Let's look at an example with object and class.

For instance, we defined a Car class. And the properties of an object Car may be model, color, and year. An object also executes some actions. A car is capable of performing the following actions: start, stop, and accelerate. Now, as you see on the slide, for different values of properties, model, color, year, in class Car, we will get different car objects. In our example, we have one class and three objects. Class Declaration. Every Java application must have at least one class definition. A class is declared by the use of the class keyword. The class body is enclosed between curly braces. The data of variables are defined in the class, and these variables are called Instance Variables.

The action code is written in the method. All code blocks are in the class body. Variables and methods are defined in the class and these are members of the class. Creating an Object. An object is created from a class. In Java, the new keyword is used to create new objects. As you see in the slide, we created the myCar object from the Car class by using the new keyword, Car myCar = new Car(); Here, the myCar object is the reference which holds the memory address of the car object. And you can create more than one object from a class. Okay.  I hope you guys all understand now the concepts of object and class. Let's take a short break here. And I'll see you in the next lesson.


About the Author
Learning Paths

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.