Java - Constructor Method versus Constructor
Is there any difference between the constructor within a class that defines an object and the constructor method called using the new operator... or are they the same?
public constructor(parameters)<-- Is this called a constructor?
ClassName cn = new ClassName(); <-- Is this called a constructor method?
Re: Java - Constructor Method versus Constructor
A constructor looks like a (non-static) method that has the same name as the class and no return type. If you construct a new object (with the 'new' opertor), the new operator allocates just enough memory on the heap and sets all bits of that memory to zero; next it calls your constructor so it can properly initialize all memory and do what it has to do. The memory is implicitly pointed to by the 'this' reference.
So, if you rename the thing 'constructor' in your code example to 'ClassName' you have the definition of a constructor for the ClassName class.