Hi all,
I have this doubt on static variables and static blocks.
See this code.
public class Static
{
static{
int x=5;
}
static int x,y;
public static void main(
String args[])
{
x--;
myMethod();
System.out.println(x+y+ ++x);
}
public static void myMethod()
{
y=x++ + ++x;
}
}
Which one will be initialized first? The static variables or the static block?
Thanks in advance,
Swapna.