Search for more details......

How to initialize variables in java


 

In java, method local variables(variables created in methods)must initialize correctly before use that variable. If not initialize a method local variables, even you can't to compile your code.



Primitive Initializing

byte      -0;
int         -0;
long      -0;
float     -0.0f
double -0.0 
and so on.

Objects

All objects-null     null means no object assignment to string reference
String -""       "" tell assign a empty string.





No comments:

Post a Comment