1
2
错误描述信息:
org.fairy.eye.domin.entity.User is not an enclosing class

​ 在 new 一个内部类的对象时,idea 会生成如下的代码。

1
2
// Info 是User的内部类
User.Info info = new User.Info();

​ 然后会提示报错 org.fairy.eye.domin.entity.User is not an enclosing class

​ 如果内部类没有用 static 修饰的话,是不能这样 new 的。

​ 需要有外部类实例对象来支持。

1
2
User user = new User();
User.Info info = new user.Info();

更新于 阅读次数

请我喝[茶]~( ̄▽ ̄)~*

有李说不清 微信支付

微信支付

有李说不清 支付宝

支付宝

有李说不清 贝宝

贝宝