I recently run into the following post:
"Java-why default parameter values where not included in Java"
http://www.velocityreviews.com/foru...ameter-values-where-not-included-in-java.html
Basically people are saying because overloaded function can do the work, default parameters are not supported in Java.
I totally understand. However, when there are a lot of parameters that are optional in a function, overloading function becomes so inconvenient...
for example, if you have a function with 10 parameters and 9 optional(that have default value),
in C++ it will just be Func(param1, param2=a, ......param10=m);
But for java, you will use 10 over loaded functions? what's more...there are permutations...
So in this case Java developers will use a parameter array...that is so much more trouble than default parameters...so...I really don't know why thy don't use it...
"Java-why default parameter values where not included in Java"
http://www.velocityreviews.com/foru...ameter-values-where-not-included-in-java.html
Basically people are saying because overloaded function can do the work, default parameters are not supported in Java.
I totally understand. However, when there are a lot of parameters that are optional in a function, overloading function becomes so inconvenient...
for example, if you have a function with 10 parameters and 9 optional(that have default value),
in C++ it will just be Func(param1, param2=a, ......param10=m);
But for java, you will use 10 over loaded functions? what's more...there are permutations...
So in this case Java developers will use a parameter array...that is so much more trouble than default parameters...so...I really don't know why thy don't use it...