This is not entirely correct.
init
blocks contain code which is included in the primary constructor. In your example, they are executed because the secondary constructor delegates to the primary constructor using the
: this(0)
syntax. If a secondary constructor does not delegate to the primary constructor,
init
blocks will not be executed when the class is initialized using that constructor. —
yole Nov 13 '15 at 10:17