What is the difference between main(String[] args) and main(String... args) in Java?

0 votes
What is the difference between public static void main(String[] args) and public static void main(String... args) in Java?
Sep 6 in Java by anonymous
45 views

1 answer to this question.

0 votes

String[] is used to accept a single parameter whereas String ... is used to accept an array of parameters. 

String ... is equivalent to String[] is only one parameter is passed to String ... but it allows you to pass multiple parameters.

But when you use String[], you can only use one parameter, you can not pass more than one parameters. 

answered Sep 6 by Piya

Related Questions In Java

0 votes
2 answers

What is the difference between Set and List in java?

LIST SET Duplicates YES NO Order Ordered Depends on Implementation Positional Access YES NO List is an ordered sequence ...READ MORE

answered Aug 14 in Java by Sirajul
• 29,340 points
117 views
0 votes
2 answers

What is the difference between getAttribute() and getParameter() in java?

getParameter() returns http request parameters. Those passed from ...READ MORE

answered Aug 28 in Java by Sirajul
• 29,340 points
723 views
0 votes
2 answers

What is the difference between Type List and type ArrayList in Java

By List, you actually tell, that your object ...READ MORE

answered Aug 28 in Java by Sirajul
• 29,340 points
81 views
0 votes
1 answer

What is the difference between getPath(), getAbsolutePath() and getCanonicalPath() in Java?

getPath() - returns a String which denotes the ...READ MORE

answered Jul 25, 2018 in Java by Mrunal
• 680 points
251 views
0 votes
1 answer
0 votes
1 answer

What is the difference == and equals() in Java?

Both the answers (Syntaxes) are correct. If ...READ MORE

answered Jun 5, 2018 in Java by Akrati
• 3,150 points
40 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,050 points
40 views
+1 vote
4 answers

What is difference between access modifier and access specifier in java

Access Specifier:- This can be understood as ...READ MORE

answered Feb 14 in Java by Priyaj
• 56,900 points
4,646 views
0 votes
2 answers

What is the difference between Map and HashMap in java?

The basic difference is : Map is ...READ MORE

answered Aug 28 in Java by Sirajul
• 29,340 points
284 views
0 votes
1 answer

Is there a way to mask the password from java user input that comes from Scanner class and System.out.Println()?

You can use the console class to do so. ...READ MORE

answered May 27 in Java by Omkar
• 67,620 points
695 views