I understand if we have a non-alphanumeric character in a String, we have to put a backward slash in front of that character. For example, we have to put a backward slach in front of a "backward slash". Eg. we do \\ to put a backward slash in a String.
What about a dot (.) or a dash (-)? Do we have to do the same thing?
posted 12 years ago
Most punctuation does not need to be escaped. (That's what it's called when you put a backslash in front of a character.)
A few that do are the backslash itself (\\) and the quotation marks (\").
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)