Forums Register Login

What is illegal escape character in java

+Pie Number of slices to send: Send
Dear Sir,
While complile this code the error message display that "Illegal escape character".Please guide me to rectify this code.

The data.txt file contains:->Sumanta,Sagar,Harish



Thanks and Regards
Sumanta Panda
[ November 21, 2008: Message edited by: Martijn Verburg ]
1
+Pie Number of slices to send: Send
Hi,

I think you should write



If you want to write a \ in a String literal you have to write \\, anyway Java compiler interprets it as an escape character. Since no such escape characters as \T or \d the java compiler reports an error.
Regards,
Miki
+Pie Number of slices to send: Send
Miklos is indeed correct, shifting to the beginners forum, more people will gain benefit from this if they search there.
1
+Pie Number of slices to send: Send
Another option is using forward slashes. File is smart enough to convert those to backslashes when accessing the actual file system.
+Pie Number of slices to send: Send
Generally speaking, when the compiler gives you an error message, it tells you more than just "illegal escape character". It will show you the line and even the exact spot it thinks the error actually is:


It GREATLY helps people help you if you post the ENTIRE message. This lets a reader instantly focus in on where the problem is, rather than having to parse you entire java file and GUESS.

Just a little helpful tip for next time.
[ November 21, 2008: Message edited by: fred rosenberger ]
+Pie Number of slices to send: Send
And check letter case at the readLine method it should be:

Message for you sir! I think it is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 80849 times.
Similar Threads
How to display the retrive data in select drop down list
split(String) problem in my jsp
How to display the retrive data in select drop down list.
How to display the retrive data in select drop down list.
How will i pass the SubjectofIssuePath in File fin=new File();
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:38:56.