Sunday, December 19, 2010

Java- Variables and default values

Class-level variables are implicitly initialized with default value.

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

Local variables should be initialized before accessing as they are not implicitly
assigned with default value.

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *