I am new to Java programming, and I am confused in the following two statements:
public static void main(String args[])
and
public static void main(String[] args)
There is no semantic difference between the two forms, the only difference is stylistics.
They mean the same thing. The second form is usually preferred because it declares an array declaration with a type declaration. By the way, there is nothing special in this main () method, arrays can be declared as anywhere in your code.
While this is true for single statements, the difference is that you define more than one variable:
String[] foo1, foo2; // both variables are of type String[] String bar1[], bar2; // here they're not. But you really shouldn't do this, causes // unnecessary confusion
Yes, they are the same, but the convention is to write String[] args , since String[] is a type.
String[] args
String[]
Both have exactly the same meaning. However, the former is unconventional and should not be used as it breaks down type information. This is a hold on C.
It is also basically the same as
public static void main(String... args)
which i prefer.
Source: https://habr.com/ru/post/1387588/More articles:https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1387583/adding-javaxvalidation-capabilities-to-tomcat&usg=ALkJrhhrjAv67f-wpeUyn7Ov5y-ENs202gHow to run apk from the command line in the emulator - androidIn Grails, how can I get the request URI, including request parameters? - httprequestCakePHP PUT API with JSON input - jsonphonegap / jquery mobile - iframe & back button - androidSQL retrieves data from the column with the most rows in - sqlHow can I control closing a console in Windows CE? - windowsIs there a way to make Visual Studio 2010 remember how I like to view the xaml file? - visual-studioHow to resize cv :: Mat image dimensions dynamically? - c ++How can I handle Ctrl + C in a Windows CE console application? - signalsAll Articles