Java's Character Literals
Character literals appear between single quote marks viz:
char c = 'a'; //make character variable c contain the letter 'a'
Certain special characters are represented by the following escape sequences (which are also placed between single quote marks in assignment statements).
|\ddd||character's octal value||d = 0 to 7
|\udddd||character's hexadecimal value|| d = 0 to F
String literals appear between double quote marks viz:
string s = "help"; /* make string variable s point to a string
array containing the letters 'help' */
To break a line within a quoted string, you must insert a \n into the string, not simply start a new line in your source file. Be careful of how you place octal character entities in strings. For instance:
\0116 is rendered as \t6 (ie a tab followed by a character 6)
\116 is rendered as N.
© 1998 Robert John Morton