Tuesday, 28 June 2016

java - how to set default method argument values?

Is it possible to set the default method parameter values in Java?



Example:
If there is a method



public int doSomething(int arg1, int arg2)
{
//some logic here
return 0;

}


is it possible to modify the given method in order to be able to call it with and without parameters?



example:



doSomething(param1, param2);
doSomething();



Thanks!

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...