Java Programming - Objects and Collections - Discussion

11. 

What is the numerical range of char?

[A]. 0 to 32767
[B]. 0 to 65535
[C]. -256 to 255
[D]. -32768 to 32767

Answer: Option B

Explanation:

The char type is integral but unsigned. The range of a variable of type char is from 0 to 216-1 or 0 to 65535. Java characters are Unicode, which is a 16-bit encoding capable of representing a wide range of international characters. If the most significant nine bits of a char are 0, then the encoding is the same as seven-bit ASCII.


Kshitij Shrivastava said: (Jun 3, 2019)  
Please explain the answer in detail.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.