Java main function Argument String args[] and string[] args difference

Source: Internet
Author: User

In fact, there is no difference, I was also such a doubt, hehe;
To say the difference is to look at the following:
There is no difference in execution effect, but slightly different in grammatical sense.
For example, string and string[], the former is called a string type and the latter is called a string array type.
String args[] is a string type from a type, and from the variable itself is an array type, so it is combined to indicate that the variable is an array of string type, that is, all elements in the array are of type string.
String[] The args form is a string array type from the type, and from the variable itself is a simple reference variable, so this way can more clearly reflect whether the point of the array. Since the variable is directly visible from the type, it is a reference to an array type.
As the first sentence says, there is nothing different about the two sentences, but if you write like this.
String args[], ARGT;
String[] args, argt;
This has a very different view. In the first sentence, args is a string array type, and ARGT is a string variable. In the second sentence, both args and ARGT are string array types.

That is: string[] args, declaring a string array, named args. String args[], declaring an array called args, with a type of string.
In fact, the function is exactly the same, both ways can be written!
This is a two-way array notation,
Most programmers prefer to use string[] args as a way of writing this style, because it separates the element type string[] from the variable name clearly.

Java main function Argument String args[] and string[] args difference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.