How does the constructor have return types? How does this code work at compilation time and runtime (if we add a main method)? Can anyone walk me through the compilation please?
The SimpleTypeName in the ConstructorDeclarator must be the simple name of the class that contains the constructor declaration; otherwise a compile-time error occurs.
In all other respects, the constructor declaration looks just like a method declaration that has no result type.
If it has a return type it is not a constructor.
I am moving this to the Beginning Java forum for you.