Quick Reminder: Default Values for Java Data Types
In Java, each primitive data type has a default value automatically assigned when declaring an uninitialized variable.
Understanding these default values is essential to prevent runtime errors. Below is a table summarizing this information.
Data Type | Default Value |
---|---|
byte | 0 |
char | '\u0000' |
short | 0 |
int | 0 |
float | 0.0f |
long | 0L |
double | 0.0d |
Commentaires
Enregistrer un commentaire