Discussion
What is the numerical range of a char?
Answer: D
Correct answer: 0 to 65535
A char is a 16-bit *unsigned* integral type, so it spans 0 to \( 2^{16}-1 = 65535 \) - the full range of UTF-16 code units. It is the only unsigned type in Java, which is why a char used in arithmetic promotes to int and why casting a negative int to char produces a large positive value rather than a negative one. The signed 16-bit range offered belongs to short.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development