Error: member names cannot be the same as their enclosing type

在编译的时候会遇到如下问题:member names cannot be the same as their enclosing type

原因:方法名和类名不能一样,如果一样就是一个构造函数。而构造函数不能有返回值。

构造函数:只写public 没有void

原文地址:https://www.cnblogs.com/cynthiahuo/p/3159031.html