Why are default parameters not supported in java language?
For example for call a constructor with 3 parameters in another type constructors with 2 and 1 and 0 parameters, we have to pass all parameters manually! They(parameters) aren't optional like other languages (set automatically default parameters for each constructor that have less than 3 parameters), why?
like this in C# code:
static void Method(int value = 1, string name = "Perl")
and if we can do something better this:
Test(String name,int code,int age)
{
setTest(name,code,age);
}
Test(String name,int code)
{
this(name,code,0);
}
Test(String name)
{
this(name,0,0);
}
So, we can use final keyword too i know it! If default parameters are not supported, is there anything better or not?