In Java, args is the abbreviation of arguments, which refers to the name of a string variable. It is a reference variable. It is just a code name. It is just a default name. You can choose it by yourself. Generally, it is habitual to write it down. String[] args is the formal parameter of the main function and can be used to obtain the parameters entered by the command line user.
1. String variable names (args) are reference variables. They are just name codes and you can choose them yourself.
2. Generally speaking, it is used to store string arrays. If you remove it, you will not know what type the variable declared by "args" is.
3. If there is public static void main, it means that when you RUN this program, this part will be RUN;
4. Everything you write in other locations is designed for this MAIN. args is the abbreviation of arguments. It is just a default name and is generally written as usual.
5. It is the variable name of a string array. If it is not the keyword args, it is the abbreviated default name of arguments. Generally, it is written as usual. You can change it to other names.
6. String[] args is the formal parameter of the main function, which can be used to obtain the parameters entered by the command line user.
7. Java itself does not have a main function without String args[]. If String args[] is removed from the Java program, an error will occur.
is as follows:
You can set parameters from run config, as shown below:
Get this args Set the parameter "test" just now and print it out:
The above is the detailed content of What does args mean in java?. For more information, please follow other related articles on the PHP Chinese website!