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

后端 未结 6 1621
青春惊慌失措
青春惊慌失措 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:36

    because when you calling this or super in constructor your object is not constructed yet. (your instance is not initialized completely yet). so calling an instance method doesn't make scene.

提交回复
热议问题