I came across some Java code that had the following composition:
public MyParameterizedFunction(String param1, int param2)
{
this(param1, param2, false);
}
public MyParameterizedFunction(String param1, int param2, boolean param3)
{
//use all three parameters here
}
I understand that in C++ I can specify a parameter a default value. For example:
void MyParameterizedFunction(String param1, int param2, bool param3=false);
Does Java recommend this kind of syntax? Are there any reasons why these two step syntax is better?