Data Type | Contents |
---|---|
Integers | |
byte | 8-bit integer | short | 16-bit integer |
int | 32-bit integer |
long | 64-bit integer |
Floating Point Numbers | |
float | 32-bit floating point |
double | 64-bit floating point |
Other Types | |
char | a single character |
boolean | true or
false
|
void | nothing |
char
type can be represented in your code
by a character delimited by ' quotes, such as:
char the_letter_a='a';
boolean
datatype is rarely used explicitly.
Rather, it is normally created by using boolean operators.
void
data type can only be used in a method
declaration. You use it to declare a method that does not return
anything. It can't be used for variables - what would they hold?
![]() |
6.2 Variable Declarations |