4.3 Object class creation
Objects of the real world that surround us can be described using attributes (characteristics or properties), as well as the actions that they perform. For example, a car can be described using the attributes “red”, “coupe”, or using the action “accelerate”. For Java programming, all of this can be represented using the Car class, which contains the color and bodyType properties, as well as the accelerate () method.
Because object attributes and methods are widely used in Java programming, Java is said to be an object-oriented programming language. Objects in Java are created by defining a class as a template from which copies (instances) can be made. Each instance of the class can be assigned attributes and methods that describe the object. Next, we create the Car class as a class template with the default attributes and methods described above. After that, an instance of the Car class is created, which inherits the same attributes and methods by default.