Originally posted by Barkat Mardhani:
Not so fast there, partner! That isn't even a constructor you've declared there!
Once you provide a return type, you no longer have a constructor for class B, you have a method within class B
named B.
If you were to remove the return type, you'd have a constructor and the compiler will give you an error.
Just to back that up, let's refer to the JLS,
§8.8.3 Constructor Modifiers:
Unlike methods, a constructor cannot be abstract, static, final, native, strictfp, or synchronized.