The character data type char, is used to represent a single character. A character literal is enclosed in single quotation marks.
The following statement assigns character 'A' to the char variable letter.
char letter = 'A';
And the following statement assigns the digit character 4 to the char variable numChar.
char numChar = '4';
Escape Sequence for Special Characters
Java defines escape sequences to represent special characters as in the following table.
What is the output of the following statement?
System.out.println("He said \"Java is fun\"");