Are class constructors void by default?
问题 I have been reading on class constructors in C#. Examples are showing overloaded class contructors. And all of them do not have a void keyword and neither they have a return value.. e.g. public Class myClass { public myClass() { } public myClass(int id) { } //other class memeber go here... } 1) So is it correct to say C# constructors are void by default? 2) Does the same applies to Java as well? 回答1: no, they are constructors, if anything, you can think of them as returning an object of the