+ 3
[DUPLICATE] What is the difference between (String... args) and (String[ ] args)?
public static void main (String... args){ System.out.println("hello"); } and public static void main (String [ ] args) { System.out.println("World"); }
2 Answers
+ 4
i believe they both work the same
+ 1
If you re executing your application trough cmd for example your app is called myFirstApp
And you type all commands to cmd to execute it .../myFirstApp connect_as_admin
Your application saves the string "connect_as_admin" to the args parameter
Public static void main(String[] args) {
If(args[0].equals("connect_as_admin)) {
...
}
}
Basicly you can set some commands to your application and than manage how your app will work but there is big difference between them because with one "args" you will work as a String field and the second is only String