Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java how to make a parameter optional

void foo(String a, Integer b) {
    //...
}

void foo(String a) {
    foo(a, 0); // here, 0 is a default value for b
}

foo("a", 2);
foo("a");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #parameter #optional
ADD COMMENT
Topic
Name
2+3 =