Hello, this is Moe. This time, I've summarized the "object-oriented" that often appears when studying Java.
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 often became a program full of defects.
To put it simply, it is "the idea of componentization used when developing software."
If one software is made into multiple parts according to this idea, it will be easier to understand the program and it will be possible to avoid "a situation where the human head cannot catch up".
An object is simply a "thing".
For example, when thinking about a car, each tire, seat, engine, etc. becomes an object.
So what is object-oriented?
In object-oriented programming, one programming is made by distinguishing the functions and roles of programming and combining them as parts (objects).
Both the classes you define when coding in Java and the instances created from them are objects.
The three major object-oriented features are:
A class is a blueprint for creating an object.
Describe the attributes (property) and behavior (method) of the object.
Properties refer to the data that an object has, and methods refer to the functions that an object has.
Taking a car as an example, it is the blueprint from which the class makes a car.
In addition, the functions such as running, turning, and stopping of the car correspond to the properties, and the specifications such as body size, body size and color, and displacement correspond to the properties.
An instance is a materialization of a class.
In the case 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 for performing initialization when instantiating a class.
--Do not have a return value (do not write the return type) --It 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 the program you want to achieve, you almost always create your own methods.
This is the first method called by the system when the program is executed.
I've always wondered what object-oriented programming is, so I'm glad I could understand it a little this time.
I will post again!
Recommended Posts