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

Numeric Promotion

Оглавление

Now that you understand the basics of arithmetic operators, it is vital to talk about primitive numeric promotion, as Java may do things that seem unusual to you at first. As we showed in Chapter 1, “Building Blocks,” each primitive numeric type has a bit-length. You don't need to know the exact size of these types for the exam, but you should know which are bigger than others. For example, you should know that a long takes up more space than an int, which in turn takes up more space than a short, and so on.

You need to memorize certain rules that Java will follow when applying operators to data types:

OCP Oracle Certified Professional Java SE 17 Developer Study Guide

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