Yes You can compile and execute without main method By using static block. But after static block executed (printed) you will get an error saying no main method found.
And Latest INFO --> YOU cant Do this with JAVA 7 version. IT will not execute.
{
static
{
System.out.println("Hello World!");
System.exit(0); // prevents “main method not found” error
}
}
But this will not execute with JAVA 7 version.