O'Reilly logo

Java Quick Syntax Reference by Mikael Olsson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required