A builder is not so different from a common method . Just as methods can be overloaded builders can too. Then you can have methods with the same name and different signatures . This makes it another method. This is useful because each can have a convenience.
In your case the first would be a complete builder that does everything it needs. The second only delegates to the first how to do the construction. So you do not need to pass the balance if it is a default value, call without it and the secondary constructor will take care of the balance for you.
This is not necessary in languages that have standard arguments, which is not the case in Java.
There is a special syntax to show that you are calling a constructor, not some method. You call the this
method. This way the compiler can treat differently. Then the secondary constructor does not construct the object, the primary constructor will. But it is he who will deliver the result, if it was invoked in the instantiation of the object.
This syntax is required because there may be non-constructor methods with the same class name.
Note that this
in the other constructor is used to disambiguate the local variable or parameter of the object attribute . So it's not all within the same this
, it's the same syntax for different mechanisms.
this(correntista, senha, 0);
In this case it is the same as
Conta(correntista, senha, 0);
It can not be called inside a constructor correctly at all times (there may be ambiguity).
Someone would think that they could have made the same code in both builders. But this violates the DRY and can create maintenance difficulties. This is not to save line of code, has important semantic purpose. There is no gain in time in this.
Understand that this is even a type of polymorphism, but we usually call it overload, because the understanding of polymorphism usually refers to something else. This terminology is somewhat ambiguous, overhead is not.
I will not comment on the other problems of this method that is not the focus of the question and for an exercise is ok.