When declaring primitives/objects, are them initialized?
Which are the default value?
What is the behavior on class members and local fields?
What about objects declaration on class members?
As answered below, these are the default values:
Data Type - Default Value (for fields)
byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char 'u0000'
String (or any object) null
boolean false
Please note that objects are initialized as null
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…