the value of static variable can be changed after it"s assigned
the value of static variable can be changed after it"s assigned
the value of static variable can be changed after it"s assigned //the value of static variable can be changed after it's assigned
public class StaticVariable{
static int i = 2;
static{
int i=5;
System.out.println('in static initialization, i is : '+i);
System.out.println('##################');
}
StaticVariable(){
System.out.println('in constructor ,i is : '+i);
}
public static void main(String[] args){
System.out.println('begin main....');
StaticVariable ff = new StaticVariable();
StaticVariable hh = new StaticVariable();
i=3;//the value of static variable can be changed after it's assigned.
System.out.println(i);
System.out.println('---------------');
StaticVariable tt = new StaticVariable();
StaticVariable bb = new StaticVariable();
}
}