What is the numerical range of a char?

By BYJU'S Exam Prep

Updated on: September 25th, 2023

What is the numerical range of a char?

1. 0 to 32767
2. 0 to 65535
3. -256 to 255
4. -32768 to 32767

Answer: Option B. 0 to 65535

0 to 65535 is the numerical range of a char for Java.

Solution

The character type or char is an unsigned integer. Char ranges from 0 to 216-1. Irrespective of the language. Every language has a different range for different data types. Like in C, the range for char type is -128 to 127. Java uses Unicode, a 16-bit encoding that may represent a large number of different international characters. The encoding is identical to seven-bit ASCII if the most significant nine bits of a character are zero. Hence, the answer to the above question is that 0 to 65535 is the numerical range of a char.

☛ Related Questions:

POPULAR EXAMS
SSC and Bank
Other Exams
GradeStack Learning Pvt. Ltd.Windsor IT Park, Tower - A, 2nd Floor, Sector 125, Noida, Uttar Pradesh 201303 help@byjusexamprep.com