java – Explanation on “this” statement [duplicate]

this(0); is an example of constructor delegation. Here you’re calling, from a constructor, the constructor that takes an pair of ints as an argument. To exploit this idiom, the call to another constructor must be the first statement of the calling constructor.

The rest of the behaviour is adequately explained with a line by line debugger.

Leave a Comment