When I pass in "$1000" through the command line and retrieve the string through args[0], it becomes "000". How can I maintain the full string in my java code?
You can escape dollar signs with a backslash or with another dollar sign. So $, $$, and \$ all replace with a single dollar sign.
The system shell prompt That dollar sign means: we're in the system shell, i.e the program that you're put into as soon as you open the Terminal app. The dollar sign is often the symbol used to signify where you can begin typing in commands (you should see a blinking cursor there).
Dollar sign ( $ ) means you are a normal user. hash ( # ) means you are the system administrator (root). In the C shell, the prompt ends with a percentage sign ( % ).
Note : You pass all the command line arguments separated by a space, but if argument itself has a space then you can pass such arguments by putting them inside double quotes “” or single quotes ”.
I guess you're using some kind of Unix system, as '$' is the variable symbol in bash & co. Try using single quotes (e.g. java MyClass '$1000'
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With