Why can't I refer to an instance method while explicitly invoking a constructor?

后端 未结 6 1631
青春惊慌失措
青春惊慌失措 2020-12-01 08:53

Does anyone know why you can reference a static method in the first line of the constructor using this() or super(), but not a non-sta

6条回答
  •  生来不讨喜
    2020-12-01 09:38

    I think its's because final instance variables are not set yet (so you have no instance yet) and an instance method could access one. Whereas all static initialization has been done before the constructor call.

    Greetz, GHad

提交回复
热议问题