[Java] [#2 Java] What is object-oriented that you often hear about?

2 minute read

Hello, this is Moe. This time, I tried to summarize the “object-oriented” that often appears when studying Java.

What is an object?

Object-oriented is a concept that was born from the fact that when trying to write a large program, the human head could not catch up and it took time to develop, or even if it was completed, it became a program full of defects. In short, it is the idea of componentization used when developing software. If one software is divided into multiple parts according to this idea, the program will be easier to understand and “a situation where the human head cannot catch up” can be avoided.
An object is simply a “thing.” For example, when thinking in terms of a car, each object such as a tire, a seat, an engine becomes an object.

So what is object orientation?
In object-oriented programming, the functions and roles of programming are distinguished, and each part (object) is combined to create one programming. Objects are both the classes that you define when you code in Java and the instances that are created from the classes.
The three major object-oriented features are:

  • Encapsulation -A function to prohibit the use of attributes and operations from some parties
  • Inherit -A function that allows you to easily create new parts by reusing the parts you made in the past
  • Diversity -A function that allows two similar parts to be regarded as “similar things” and used for “good luck”


A class is a blueprint for creating objects. Describe the attribute (property) and behavior (method) of the object. A property is the data that an object has, and a method is the function that an object has.
Taking a car as an example, the class is the blueprint from which a car is built. In addition, functions such as running, turning, and stopping of a car correspond to properties such as method, body size, body size and color, and specifications such as displacement.


An instance is an instantiation of a class. If we consider the example of a car, an instance is a car manufactured based on a blueprint. Also, creating an object from a class is called “instantiation”.


This is a special block that performs initialization processing when instantiating a class.

  • Must have no return value (do not write return type)
  • Has the same name as the class


A method is a collection of a series of processes. There are too many methods to remember, but you can create your own. Rather, when writing a program that you want to realize, most of the time, you will create your own method.

main method

The first method called by the system when running a program.

Until now, I was wondering “what is object-oriented…”, so I’m glad I could understand a little this time. I will post again!