Character literals

suggest change

Character literals provide the most convenient way to express char values in Java source code. A character literal consists of:

For example:

char a = 'a';
char doubleQuote = '"';
char singleQuote = '\'';

A line-break in a character literal is a compilation error:

char newline = '
// Compilation error in previous line
char newLine = '\n';  // Correct

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents