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, 2019 in Java by anonymous
573 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, 2019 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, 2019 in Java by Sirajul
• 54,020 points
433 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, 2019 in Java by Sirajul
• 54,020 points
5,298 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, 2019 in Java by Sirajul
• 54,020 points
298 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
568 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
89 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,090 points
86 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, 2019 in Java by Priyaj
• 57,530 points
15,626 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, 2019 in Java by Sirajul
• 54,020 points
6,990 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, 2019 in Java by Omkar
• 69,040 points
3,402 views