equals() generated by Eclipse: getOuterType()?

后端 未结 1 2016
耶瑟儿~
耶瑟儿~ 2021-01-17 11:10

I have simple class Point with two fields of type double. I asked Eclipse 3.6 to generate equals() and hashCode() for it. The eq

1条回答
  •  情话喂你
    2021-01-17 11:52

    Well, if your class is an inner class (non-static nested class), it has an outer, enclosing instance. Two objects of an inner class type aren't really equal unless the enclosing instances are equal, too; the outer instance like a hidden field (usually named this$0 by javac).

    0 讨论(0)
提交回复
热议问题