Default argument like c++


is there a way so i can write default argument in processing like c++?
in c++, for example:

void test(a=100)
… //some function that print value of a

so, when we call the function of test, if we dont passed value to that function, it will print 100
for example:
test() //print 100
test(200) //print 200


yes, looks little bit stupid, but works:

void setup() {

void test(){
void test(int a){




Java does not have built-in default arguments.

@kll demonstrated one approach – method overloading, in which one signature has no arguments, and calls the second signature while supplying the default argument.

There are other approaches. One is to test for null and, if null, assign a default value. Then the no-arg form of a method call is foo(null). Another approach is to use varargs, and likewise check if each arg is present, and if not, assign its default. Another is to use the Builder pattern, in which each optional argument is a method.

A good summary of six approaches to default handling is in this answer: