Java Uses command line parameters-general Linux technology-Linux programming and kernel information. The following is a detailed description. Sometimes you want to pass information to a program when running the program. This is achieved by passing the command-line arguments to main. The command line parameter is the information that follows the program name in the command line during program execution. Accessing command line parameters in Java programs is quite easy-they are stored as strings in the String array passed to main. For example, the following program shows all the command line parameters called:
// Display all command-line arguments.
Class CommandLine {
Public static void main (String args []) {
For (int I = 0; iSystem. out. println ("args [" + I + "]:" +
Args
);
} }
Run the following command to execute this program:
Chapter 2 further research methods and categories
Java Commandline this is a test 100-1
After execution, you will see the following output:
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.