Home Segments Top Top Previous Next

65: Mainline

All Java variables have a default value until they are initialized or assigned. Thus, no Java variable is ever without a value. The default value of a number is 0.

Java expects you to assign a value to every variable, even though Java supplies default values. If Java can determine that you do not assign a value to a variable before you use that variable's value, Java will refuse to compile your program.