Java - general

Optional parameters (...)

There is the possibility to call up a method with optional parameters.


public void myMethod(Object... args) {
   for (Object arg : args)
      System.out.println(arg);
}


Calls can occur as follows:

myMethod("A", "B", "C");
myMethod("D", "E");

Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007