I have been working on Java off late, couldn’t figure out what this (String… arg) means in
public static void main(String… arg) {}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
...is called varargs and is used to allow for variable number of function parameters.For example if you declare a function as
Then you can call it as:
or
or
The variable
arris actually of type int[] in the body of the function and it contains the parameters, so arr = [4], arr = [4, 5] and arr = [4,5,6] respectively