I have a doubt regarding a static block. Here i have two classes(C1,C2).
_______________________________________________
class C1
{
static int x=10;
static
{
intx=99;
}
public static void main(
String args[])
{
System.out.println("The value of x is : "+x);
}
}
_________________________________________________
class C2
{
static int x=10;
static
{
x=99;
}
public static void main(String args[])
{
System.out.println("The value of x is : "+x);
}
}
____________________________________________________
C1 produces an output of 10.
Whereas C2 produces 99.
What is exactly happening inside the static block??
-phil