assigning parameter default value in function declaration
Hi,
I want to declare a method in which there are 5 to 6 parameters present and most of the parameter remain same while calling that method. so I want to assign a default values to these parameter at method declaration, so user wont need to enter the values of these parameters while calling that method.
My function should look like:
publicboolean methodName( String var1 ="check", String var2 ="check", String var3 ="check", String var4 ="uncheck", String var5 ="check", String var6 ="check")
{
// Now I will compare the variable values and if it is "check" then i will click on the check box or if it is uncheck then i should uncheck the check box.
// and most the time values for these parameters should be the same.
Now what i want is when i call this method and if i want to change the sencond parameter only thru this method then i should be able to call my method like:
methodName( ,uncheck,,,,,);
// I didnt write the value of each parameter, bcoz my method should take these values automatically.
I tried to do it myself, but i was getting error while initializing the String variable in method arguments.
Error: Syntax error in token, delete this token.
Hope, i was able to explain my question, and if you any idea about this problem and your help would be much appreciated.
Thanks and Regards,
Ashish

