As far as i know, constructors can be static.

any declaration in static block is executed before main executes.
there may be multiple static block in a class and they may appear
anywhere inside the class (location is not important).
in case of multiple static blocks, they are executed in the sequence
in which they appear in code.


Example:

public class SampleClass {
    static {
        System.out.println("I am inside static block...");
    }

    public static void main(String[] args) {
        System.out.println("I am inside main now...");
    }
}


I have learnt this from the book: "Effective Java"

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to