Java's primitive data types are very similar to those of C. The boolean type has been added. However the implementation of the data types has been substantially cleaned up in several ways.
int) Java specifies everything.
Here are the detailed data types:
boolean
true and false only.
true and false are defined constants of the language
and are not the same as True and False,
TRUE and FALSE, zero and nonzero, 1 and 0
or any other numeric value. Booleans may not be cast into any other
type of variable nor may any other variable be cast into a boolean.
byte
short
int
long
float
Like all numeric types floats may be cast into other numeric types (byte,
short, long, int, double).
When lossy casts to integer types are done (e.g.
float to short) the fractional part is truncated and the
conversion is done modulo the length of the smaller type.
double
char
Chars are not the same as bytes, ints, shorts or Strings.
sizeof isn't necessary in Java because all sizes are precisely
defined. i.e. an int is always 4 bytes.
This may not seem to be adequate when dealing with objects that
aren't base data types. However even if you did know the size of
a particular object, you couldn't do anything with it anyway.
You cannot convert an arbitrary object into bytes
and back again.