Thursday, April 21, 2011

Primary data types and their default values

Each primitive data type has a default value specified. Variable of primitive data type may be initialized.
Only class member variables are automatically initialized. Method variables need explicit initialization.

Primitive Data type Default Value
byte 0
short 0
int 0
long 0L or 0l
float 0.0f
double 0.0d
boolean false
char '\u0000'

No comments:

Post a Comment