Every java application program starts exection from :
public static void main(String[] arg) method of class.
But if class contains the static block then execution will
begin from there.
Program: StartingPoint.java
public class StartingPoint {
static {
System.out.println("static block executed");
}
public static void main(String[] arg) {
try {
System.out.println("main method executed");
} catch (Exception e) {
e.printStackTrace();
}
}
}
OUTPUT:
static block executed
main method executed
CoreJava Important Tricks | Tips | Java Linux IDE | Technology Updates | Download Free CoreJava Examples | Video Tuorials | Concepts of Classes
Blog Archive
My Blog List
Monday, January 19, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment