One of hundreds of answers available with our premium content service.
A: A constructor is a special class method that is used to create an instance of the class. A constructor method is named after the class it belongs to and may have arguments. The constructor returns an instance of the class, which is an object you can use in your Java program.
The constructor is called without referring to an instance of the class. When you use the new keyword followed by the name of the class with parentheses, the Java compiler knows this is a constructor call for the class. The class instance it returns is normally assigned to a variable with an appopriate type, as below. You can call the constructor as many times as you like and it should always return an instance.
Object objectInstance = new Object();
… full answer hidden
Premium members click below for full answer
What is a constructor?