hai Manoj,
Yes you can get the output as 10 because while runtime first static block will run before main method.In that code you terminating that program after static block you will get the output of 10.
If that wont have
------------------------
System.exit(0);
------------------------
in your program you will get NosuchMethodError after printing 10 like this
10
Exception in
thread "main" java.lang.NoSuchMethodError: main
For more detail modify your program by
-------------------------------------
public class QTest{
static{
print(10);
}
static void print(int x){
System.out.println(x);
}
public static void main(
String arg[])
{
System.out.println("i am in main");
}
}
-------------------------------------------
You will get the output as:
10
i am in main.
From this you come to know that after static block only main will run.
Regards,
Premavenkat.