ICSE Class 10 Computer Applications Question 6 of 76

Revising Basic Java Concepts — Question 6

Back to all questions
6
Question

Question 6

What is a character constant in Java ? How are non graphic characters represented in Java ?

Answer

Single character enclosed in single quotation marks (' ') makes a character literal. For example, 'a', '5', $\text{\textdollar}, '1' are character literals.

Non-graphic characters are represented in Java using escape sequence. An escape sequence is represented by a backslash (\) followed by one or more characters. For example, '\n', '\t' are escape sequences for new line and tab respectively.