Martin said:
Is it possible in Java to write a method, which allows an
arbitrary number of formal parameters?
No. But it is possible to declare a method /that/¹ allows
an arbitrary number of /arguments/ at run-time. This only
needs a single formal parameter declaration
like »java.lang.Object ... arguments«. See:
http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.1
»LastFormalParameter:
VariableModifiers Type ...opt VariableDeclaratorId
FormalParameter
[...] If the last formal parameter is a variable arity
parameter of type T, it is considered to define a formal
parameter of type T[]. The method is then a variable arity
method. Otherwise, it is a fixed arity method. Invocations
of a variable arity method may contain more actual
argument expressions than formal parameters. All the
actual argument expressions that do not correspond to the
formal parameters preceding the variable arity parameter
will be evaluated and the results stored into an array
that will be passed to the method invocation (§15.12.4.2).«
(", which" is used for a non-restrictive clause.)