Initializing final fields in Java

后端 未结 4 1864
生来不讨喜
生来不讨喜 2021-02-07 10:12

I have a class with lots of final members which can be instantiated using one of two constructors. The constructors share some code, which is stored in a third constructor.

4条回答
  •  抹茶落季
    2021-02-07 10:46

    You get this error because if you had called MyClass(SomeType oneIn), two is not initialized.

提交回复
热议问题