About C++ default parameter in Java

Joined
Aug 8, 2008
Messages
1
Reaction score
0
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top