Yes, that is how it works. The arguments are automatically put into an array. The argument "urls" behaves like a URL[]. Varargs are documented here. They were introduced in Java 1.5, so, are available in J2SE 1.5+, and all of Android since it supports Java 1.5+ language features. No version of JavaME/J2ME supports it.

Answer from Sean Owen on Stack Overflow
🌐
Baeldung
baeldung.com › home › java › core java › best practices for passing many arguments to a method in java
Best Practices for Passing Many Arguments to a Method in Java | Baeldung
June 6, 2025 - Parameter Objects are helpful when there are many required parameters, and immutability is important. At the same time, we use Java Beans when we need to modify the object’s state at different times during its lifetime. Let’s see an example of calling a method by passing multiple arguments before we go into in-depth discussions of each pattern:
🌐
W3Schools
w3schools.com › java › java_methods_param.asp
Java Method Parameters
Parameters act as variables inside the method. Parameters are specified after the method name, inside the parentheses. You can add as many parameters as you want, just separate them with a comma.
🌐
Study.com
study.com › business courses › business 104: information systems and computer applications
Java Varargs: Use & Examples - Lesson | Study.com
September 17, 2020 - See how varargs loops through arguments, the code required to use it in Java, and what happens when it needs to handle multiple arguments at once.
🌐
Programiz
programiz.com › java-programming › varargs
Java Varargs (Variable Arguments) With Examples
To address this problem, Java 1.5 introduced varargs. Varargs is a short name for variable arguments. In Java, an argument of a method can accept arbitrary number of values.
🌐
InfoWorld
infoworld.com › home › software development › programming languages › java
Too Many Parameters in Java Methods, Part 6: Method Returns | InfoWorld
November 18, 2013 - This approach often violates the principle of least astonishment as most Java developers probably expect parameters to be INcoming rather than OUTgoing (and Java doesn’t provide any code support to specify the difference). Bob Martin puts it this way in his book Clean Code, “In general, output arguments should be avoided.” Another disadvantage of using arguments as a means for a method to provide state or output to the caller is that this adds to the clutter of arguments passed to a method.
Find elsewhere
🌐
Medium
naveen-metta.medium.com › mastering-method-argument-management-best-practices-in-java-b12b53060d45
Mastering Method Argument Management: Best Practices in Java | by Naveen Metta | Medium
May 5, 2024 - Instead, developers can pass any number of arguments of the specified type, making method invocation more flexible and concise. In Java, varargs are denoted by an ellipsis (…) following the parameter type in the method signature.
🌐
Oracle
docs.oracle.com › javase › tutorial › java › javaOO › arguments.html
Passing Information to a Method or a Constructor (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
You can use a construct called varargs to pass an arbitrary number of values to a method. You use varargs when you don't know how many of a particular type of argument will be passed to the method.
🌐
DZone
dzone.com › coding › languages › too many parameters in java methods, part 3: builder pattern
Too Many Parameters in Java Methods, Part 3: Builder Pattern
November 18, 2013 - Further benefits of the Builder pattern when used with constructors are outlined in Item #2 of the Second Edition of Effective Java. ... As shown and mentioned above, the number of lines of code of a given class must be essentially doubled for "set" methods with the builder approach. Furthermore, although client code is more readable, the client code is also more verbose. I consider the benefit of greater readability worth the cost as the number of arguments increase or as more arguments share the same type or as the number of optional arguments increase.
🌐
Medium
medium.com › @quipoin04 › varargs-in-java-simplifying-methods-with-variable-arguments-543b221c4cfa
Varargs in Java — Simplifying Methods with Variable Arguments | by Quipoin | Medium
October 4, 2025 - To solve this, Java introduced ... of the same type. Varargs (short for variable arguments) allow you to pass an arbitrary number of arguments to a method without manually creating an array....
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 133321 › how-methods-with-multiple-parameters-are-declared
java - How methods with multiple parameters are ... | DaniWeb
Inside the method, those parameter names are local; the caller’s variable names do not matter. Calls must match the number, types (after allowed conversions), and order of parameters. Java is pass-by-value: the value of each argument is copied into the parameter.
🌐
GeeksforGeeks
geeksforgeeks.org › java › variable-arguments-varargs-in-java
Variable Arguments (Varargs) in Java - GeeksforGeeks
April 23, 2026 - Can be combined with other parameters, but remaining arguments are grouped into an array. ... import java.io.*; class Geeks { // Method that accepts variable number of String arguments using varargs public static void Names(String...
Top answer
1 of 7
119

You could write a convenience method:

public PrintStream print(String format, Object... arguments) {
    return System.out.format(format, arguments);
}

But as you can see, you've simply just renamed format (or printf).

Here's how you could use it:

private void printScores(Player... players) {
    for (int i = 0; i < players.length; ++i) {
        Player player = players[i];
        String name   = player.getName();
        int    score  = player.getScore();
        // Print name and score followed by a newline
        System.out.format("%s: %d%n", name, score);
    }
}

// Print a single player, 3 players, and all players
printScores(player1);
System.out.println();
printScores(player2, player3, player4);
System.out.println();
printScores(playersArray);

// Output
Abe: 11

Bob: 22
Cal: 33
Dan: 44

Abe: 11
Bob: 22
Cal: 33
Dan: 44

Note there's also the similar System.out.printf method that behaves the same way, but if you peek at the implementation, printf just calls format, so you might as well use format directly.

  • Varargs
  • PrintStream#format(String format, Object... args)
  • PrintStream#printf(String format, Object... args)
2 of 7
26

This is known as varargs see the link here for more details

In past java releases, a method that took an arbitrary number of values required you to create an array and put the values into the array prior to invoking the method. For example, here is how one used the MessageFormat class to format a message:

Object[] arguments = {
    new Integer(7),
    new Date(),
    "a disturbance in the Force"
};
    String result = MessageFormat.format(
        "At {1,time} on {1,date}, there was {2} on planet "
         + "{0,number,integer}.", arguments);

It is still true that multiple arguments must be passed in an array, but the varargs feature automates and hides the process. Furthermore, it is upward compatible with preexisting APIs. So, for example, the MessageFormat.format method now has this declaration:

public static String format(String pattern,
                            Object... arguments);
🌐
Quora
quora.com › How-do-you-pass-multiple-parameters-to-one-method-in-Java
How to pass multiple parameters to one method in Java - Quora
Answer: When you create method signature then you have choice to create method with no parameter, Single parameters or multiple parameters for more details please go through below method signature. Method without parameter accessModifier returntype methodName() public void demoMethod() {} Met...
🌐
javaspring
javaspring.net › blog › arguments-in-java
Understanding Arguments in Java — javaspring.net
Methods with too many arguments can be difficult to read, understand, and maintain. If a method requires a large number of arguments, consider refactoring it into smaller methods or using a class to group related data.
🌐
Medium
medium.com › @cibofdevs › understanding-variable-arguments-in-java-1e38cde2aff2
Understanding Variable Arguments in Java | by Ahmad Wijaya | Medium
June 17, 2024 - One such feature that enhances flexibility is the use of variable arguments (varargs). Varargs allow methods to accept an arbitrary number of arguments, making code more readable and adaptable.
🌐
AlgoCademy
algocademy.com › link
Function Parameters And Arguments in Java | AlgoCademy
We have passed one string argument: "humans". Inside the function audience will equal string "humans" and acts just like a regular variable. ... A function can have as many parameters as it needs.
🌐
Medium
medium.com › @AlexanderObregon › handling-variable-arguments-with-javas-varargs-e578117991a4
Handling Variable Arguments with Java’s varargs | Medium
March 12, 2025 - Java’s varargs feature allows methods to accept a flexible number of arguments, but it doesn’t change the fact that methods in Java require a fixed number of parameters at the bytecode level. The compiler works around this by automatically converting varargs into an array, allowing the method to accept multiple values while keeping the method signature manageable.