A character literal can be expressed as an octal escape sequence in the form '\nnn'.
n is an octal digit (0-7). The range for the octal escape sequence is '\000' to '\377'.
The octal number 377 is the same as the decimal number 255.
Using octal escape sequence, you can represent characters whose Unicode code range from 0 to 255 decimal integers.
char c1 = '\52'; char c2 = '\141'; //char c3 = '\400'; // A compile-time error. Octal 400 is out of range char c4 = '\42'; char c5 = '\10'; // Same as '\n'
public class Main { public static void main(String[] args) { char c1 = '\52'; char c2 = '\141'; //char c3 = '\400'; // A compile-time error. Octal 400 is out of range char c3 = '\42'; char c4 = '\10'; // Same as '\n' System.out.println(c1);/*from w w w. j a va2 s . co m*/ System.out.println(c2); System.out.println(c3); System.out.println(c4); } }