In my code, I have a method which has got to take 4 parameters. But in somewhere in the code i call this method with sometimes 2, sometimes 4 parameters. So when i call with 2 parameters, the last 2 parameters should go automaticly null.
For example:
public static void x(String one,String two,String three=null,String four=null){
//do something hear
}
x("one","two");
x("one","two","three","four");
When I call x("one","two") => I want that the three and four parameters automatticaly initialize to null.
How can i do that ? Thanks for helps.