| Author |
help regarding escape character
|
Venu Chakravorty
Ranch Hand
Joined: Aug 19, 2009
Posts: 46
|
|
hi,
i get a compile time error upon compiling:
perhaps because "\d" is not an escape character, where as in the next code:
"/d" gets printed when i invoke - java A "\d".
in the later case doesn't the String "\d" get assigned to "args[0]"? or maybe i am getting no error because i am trying to assign a value at runtime?
regards, venu
|
 |
Sebastian Janisch
Ranch Hand
Joined: Feb 23, 2009
Posts: 1183
|
|
|
The values passed to the program are escaped by the JVM ...
|
JDBCSupport - An easy to use, light-weight JDBC framework -
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
The only thing that's relevant here is that to write an actual '\' character inside a String in Java source code, you must double it:
args[0] = "\\d";
The same goes for character constants:
char c = '\\';
There's no "escaping" of characters read from the command line or from files; a \ is just an ordinary character at runtime. Escaping is just used to turn off the special meaning of the \ character in source code.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Venu Chakravorty
Ranch Hand
Joined: Aug 19, 2009
Posts: 46
|
|
|
thanks
|
 |
 |
|
|
subject: help regarding escape character
|
|
|