Java - A description of its Variables
Here you can find information about Java's use of Variables and a examples of how they are used
[ Back to the Main Java Page ]
Character Data Type
char variablename = value;
example:
char A_A = 'A'; |
Numeric Data Types
| Type | Range | Size |
|---|---|---|
| byte | -128 to 127 | 8-bit signed |
| short | -32768 to 32767 | 16-bit signed |
| int | -2147483648 to 2147483647 | 32-bit signed |
| long | -9223372036854775808 to 9223372036854775807 | 64-bit signed |
| float | -3.4E38 to 3.4E38 (6 to 7 digits accuracy) | 32-bit IEEE 754 |
| double | -1.7e308 to 1.7e308 (14 to 15 significant digits accuracy) | 64-bit IEEE 754 |
Constants
final datatype CONSTANTNAME = value;
where:
final : final is a Java keyword that means the constant cannot be changed.
datatype : datatype may be one of byte, short, int, long, float, double, char, boolean
CONSTANTNAME : the constant name is a valid Java Variable name, preferable in all uppercase letters.
value : value is any value appropriate for the datatype
examples:
| final double PI = 3.14159; final int Monday = 1; final int Tuesday = 2; final String HELLOWORLD = "Howdy to Earth "; |
Boolean Data Type
examples:
| boolean isChecked = true; boolean wasConfirmed = false; |
String Data Type
examples:
| String AuthorName = "John H Doe"; String PleaseCompleteMessage = "Please Complete All Fields"; |













