Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 95

Signed and Unsigned: short and char

Оглавление

For the exam, you should be aware that short and char are closely related, as both are stored as integral types with the same 16-bit length. The primary difference is that short is signed, which means it splits its range across the positive and negative integers. Alternatively, char is unsigned, which means its range is strictly positive, including 0.

Often, short and char values can be cast to one another because the underlying data size is the same. You learn more about casting in Chapter 2, “Operators.”

OCP Oracle Certified Professional Java SE 17 Developer Study Guide

Подняться наверх