Java — What is the numerical range of the char data type?

Difficulty: Easy

Correct Answer: 0 to 65535

Explanation:

Introduction / Context:The char type in Java is a 16-bit unsigned integer representing a Unicode character. Unlike C/C++, Java chars are not signed and cover a wide range of Unicode code points.

Given Data / Assumptions:

  • char size: 16 bits (2 bytes).
  • Unsigned, not negative.
  • Stores Unicode characters.

Concept / Approach:The range of a 16-bit unsigned integer is 0 to (2^16 - 1) = 65535.

Step-by-Step Solution:

Minimum: 0 → represents null character '\u0000'.Maximum: 65535 → corresponds to '\uffff'.

Why Other Options Are Wrong:

  • 32767 is max for signed 16-bit, but char is unsigned.
  • -256 to 255 describes byte range incorrectly.
  • -32768 to 32767 describes signed short, not char.

Final Answer:0 to 65535

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion