In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly describes how to receive command line parameters in Java, the article is very detailed, has a certain reference value, interested friends must read!
Command-line arguments refer to parameters given on the command line.
What are command-line arguments?
For example:javaTest1365156"China"
(Test1 above must be the main class, otherwise it cannot run)
What are command-line arguments and who receives them?
A program begins with a call to the function main(). In doing so, two parameters are given to main(),
One describes the number of command-line arguments, often called argc; the other is an array of command-line arguments, often called argv.
Command line arguments are strings, so argv is of type char*[argc+1]. The name of the program is also passed in as argv[0],
So argc has a value of at least 1. The list of parameters always ends with 0, i.e. argv[argc]==0. [1]
What should be noted when parameters are given on the command line?
Command line arguments are separated by spaces. However, if the command line argument itself contains spaces, then
The argument must be enclosed in a pair of double quotes.
For example:javaTest1365156China"BeijingofChina"
Command line input *(means multiplication) method: if directly in the command line input *(multiplication), the system will be processed into the current path name of several strings, if * means multiplication, should enter "*" or "*", by args to get the string, and then use trim() to remove both ends of the space can, of course, can also enter "#*", and then find a way to remove the previous #can be, that is, as long as you do not enter * alone.
TotalCommander can start with one or two folders as command-line arguments. These folders are used to set up file windows on one or both sides. This way you can create multiple icons for TotalCommander in the program or launch menu, opening different folders and even zipped packages after each TotalCommander launch. And you can specify different ini files, beyond the default wincmd.ini, so that different users on the same machine can have different settings.
The above is "How to receive command line parameters in Java" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.