public class StaticTest
{
static
{
System.out.println(“Hi there”);
}
public void print()
{
System.out.println(“Hello”);
}
public static void main(String args[])
{
StaticTest st1 = new StaticTest();
st1.print();
StaticTest st2 = new StaticTest();
st2.print();
}
}
Never.
Each time a new object of type StaticTest is created.
Once when the class is loaded into the Java virtual machine.
Only when the main() method is executed.