August 2003
Intermediate to advanced
672 pages
16h 23m
English
A variable stores a value of a particular type. A variable has a name, a type, and a value associated with it. In Java, variables can only store values of primitive data types and references to objects. Variables that store references to objects are called reference variables.
Variable declarations are used to specify the type and the name of variables. This implicitly determines their memory allocation and the values that can be stored in them. We show some examples of declaring variables that can store primitive values:
char a, b, c; // a, b and c are character variables. double area; // area is a floating-point variable. boolean flag; // flag is a boolean variable.
The first ...
Read now
Unlock full access