We construct objects in previous chapters but we did not code constructors. So how did we do that?
For any class without coded constructor(s), Java will automatically add what is called a "default constructor". It is not visible, but it is present and usable.
Here we show what a default constructor looks like. Note that it does no initialization.
public Rectangle() {
}
When you have no constructors coded in a class, it is generally a better idea to add a no-arg constructor. That way you can assure proper initialization is done.
Example usage:
Rectangle rec;
rec3 = new Rectangle();
Introduction To Objects With Java
(Chapter 406 - Constructors)