CHAPTER 3

image

Variables

Variables are used for storing data during program execution.

Data types

Depending on what data you need to store there are several kinds of data types. Java has eight types that are built into the language. These are called primitives . The integer (whole number) types are byte, short, int and long. The float and double types represent floating-point numbers (real numbers). The char type holds a Unicode character and the boolean type contains either a true or false value. Except for these primitive types, every other type in Java is represented by either a class, an interface or an array.

Data Type Size (bits) Description ...

Get Java Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.