You can use a construct called varargs to pass an arbitrary number of values to a method.
You will most commonly see varargs with the printing methods; for example, this printf method:
public PrintStream printf(String format, Object... args)
allows you to print an arbitrary number of objects. It can be called like this:
System.out.printf("%s: %d, %s%n", name, idnum, address);
or like this
System.out.printf("%s: %d, %s, %s, %s%n", name, idnum, address, phone, mail);
or with yet a different number of arguments.