Answers for "what is known as optional parameter from the given"

0

java how to make a parameter optional

void foo(String a, Integer... b) {
    Integer b1 = b.length > 0 ? b[0] : 0;
    Integer b2 = b.length > 1 ? b[1] : 0;
    //...
}

foo("a");
foo("a", 1, 2);
Posted by: Guest on July-16-2020

Code answers related to "what is known as optional parameter from the given"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language