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

The Primitive Types

Оглавление

The exam assumes you are well versed in the eight primitive data types, their relative sizes, and what can be stored in them. Table 1.6 shows the Java primitive types together with their size in bits and the range of values that each holds.

TABLE 1.6 Primitive types

Keyword Type Min value Max value Default value Example
boolean true or false n/a n/a false true
byte 8-bit integral value -128 127 0 123
short 16-bit integral value -32,768 32,767 0 123
int 32-bit integral value -2,147,483,648 2,147,483,647 0 123
long 64-bit integral value -263 263 – 1 0L 123L
float 32-bit floating-point value n/a n/a 0.0f 123.45f
double 64-bit floating-point value n/a n/a 0.0 123.456
char 16-bit Unicode value 0 65,535 \u0000 'a'
OCP Oracle Certified Professional Java SE 17 Developer Study Guide

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