YES....static block can execute without main() if we are using previous version of JDK
It will not supported by JDK 7..
class Demo
{
static{
System.out.println("helllo.....");
System.exit(0);
}
}
static block will execute if we compile and interpret above code with previous version of JDK (not supported by jdk7)
It will not supported by JDK 7..
class Demo
{
static{
System.out.println("helllo.....");
System.exit(0);
}
}
static block will execute if we compile and interpret above code with previous version of JDK (not supported by jdk7)
excellent
ReplyDeletethnks
ReplyDelete