When creating multiple constructors, I usually do the following;
public ConstructorName(int count)
{
this(count, 0);
}
public ConstructorName(String count)
{
this(Integer.parseInt(count), 0);
}
public ConstructorName(int count, int other)
{
// Do something here
}
However, I can also do it this way;
public ConstructorName(String count)
{
this(Integer.parseInt(count)); // Chain to the constructor that just takes a number
}
public ConstructorName(int count)
{
this(count, 0);
}
public ConstructorName(int count, int other)
{
// Do something here
}
Is there any actual difference here? Which would be better to use when coding?