Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java static variables and static constants
Java static variables and static constants
Common class static constant

{

//Static variable!

Private static int sum = 88

//Static constant!

Private static final int con = 99

Public static void main(string[] args)

{

System.out.println ("sum of variables before change ="+sum ");

sum-;

System. out. println(" sum = "+ sum after variable change ");

system . out . println(" con = "+con before change);

//con++; Once this comment is cancelled, it will report an error: the last variable con cannot be assigned a value.

system . out . println(" changed con = "+con);

}

}