Answers for "how to declare optional parameters in a class in java"

0

java how to make a parameter optional

void foo(String a, Integer b, Integer c) {
    b = b != null ? b : 0;
    c = c != null ? c : 0;
    //...
}

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

Code answers related to "how to declare optional parameters in a class in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language