File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Representation of strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Representation of strings" Watch "Representation of strings" New topic

Representation of strings

vinayak manda
Ranch Hand

Joined: Jul 27, 2004
Posts: 31
Which are valid/invalid and if so why?

String s = "\n";
String s1="\r";
String s2= "\u000a";
String s3 ="\u000d";
String s4="'\u0041'";
String s5="\u0041";
String s6 ="\uD7AF";
Louie van Bommel
Ranch Hand

Joined: Aug 17, 2004
Posts: 76
Hop to the jls, section 3.10.5 String Literals
I agree. Here's the link:
subject: Representation of strings
It's not a secret anymore!