Which of the following is a valid declaration of a char?
A. char ch = ‘\utea’;
B. char ca = ‘tea’;
C. char cr = \u0223;
D. char cc = ‘\itea’;
Answer:A
Which of the following is a valid declaration of a char?
A. char ch = ‘\utea’; B. char ca = ‘tea’; C. char cr = \u0223; D. char cc = ‘\itea’;
Explanation: A char literal may contain a Unicode character (UTF-16). We can directly use these characters only if our file system allows us, else use a Unicode escape (\u) such as “\u02tee”. The char literals are always declared in single quotes (‘).