[HD Pg 48, Sec. 2.5.2 - command-line-arguments]
Posted: Thu Dec 27, 2018 4:09 pm
Table 2.5 page 49, last entry.
java TestClass "\"" args[0] = """ To pass a quote character as an argument, you have to escape it using a backslash.
I tried it, and got compiler error - unbalanced quotes. Also tried \", got the same error.
Tried "\'" (backslash and single quote within two double quotes) and got \'! Also tried \r and "\r" and both resulted in \r!
So doesn't look like back slash inside double quotes or outside, has any meaning to the compiler as it takes in arguments to main()!
What happened?
java TestClass "\"" args[0] = """ To pass a quote character as an argument, you have to escape it using a backslash.
I tried it, and got compiler error - unbalanced quotes. Also tried \", got the same error.
Tried "\'" (backslash and single quote within two double quotes) and got \'! Also tried \r and "\r" and both resulted in \r!
So doesn't look like back slash inside double quotes or outside, has any meaning to the compiler as it takes in arguments to main()!
What happened?