A Variable is an object that can hold a value. The are called variables
since you can change the value it holds the value is said to vary.
Java has several different types of variables. Some hold numeric data, some hold
character data, and some hold references to other objects.
Variables can be of two types:
Primitive – to hold numbers, characters, booleans.
int X;
Reference – hold references to objects (hold that thought for a minite)
Dog d;
Two things are required to declare a variable:
Type
Name
Naming Variables
Must start with a letter or the underscore character, but not numbers.
After the first character you can use letters, numbers, or the underscore.
Cannot be one of the Java reserved words.
Try to use variable names that are meaningful...
Primitive Variable types
Boolean and Character
Integer
Floating Point
Reference Variables
These variables holds a "way to get to an object". One way to think of a reference
variable is as a remote control for an object.