Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to print string containing \123

843789May 29 2009 — edited May 29 2009
Hi

What i am trying to do is

String string = "sdfasfsaf \123 sdfsdf \23 sdfsdf\4";
System.out.println(string);

But problem is that it escapes numbers after \ and prints the charater instead.

How can i print such strings. How can i add one more slash before so that it will not escape it and print the string as it is.

So that the output will be
sdfasfsaf \123 sdfsdf \23 sdfsdf\4

thanks & regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2009
Added on May 29 2009
17 comments
5,904 views