Breaking News
Home / Java / Java FAQ / What are the default values for primitive datatypes in Java?

What are the default values for primitive datatypes in Java?

The following table lists out default value of  the various primitive data types:

Data Type         Default Value

byte                           0

short                           0

int                               0

long                            0L

float                          0.0f

double                       0.0d

char                        ‘u0000’

String (or any object)    null

boolean                       false

[pb_builder]

Check Also

When is OCAJP Java certification going live?

After completing the BETA phase of testing last year, the Oracle’s new OCAJP Java certification, …

Advertisment ad adsense adlogger