Write a static block which will be executed before main( ) method in a class.

// Write a static block which will be executed before main( ) method in a class.

public class Code9 {

static {

System.out.println("I'm Static Before Main Method");

}

public static void main(String arg[]) {

System.out.println("I'm Main Method");

}

static {

System.out.println("I'm Static After Main Method");

}

}

Comments

Popular posts from this blog

Write a program in Java to find second maximum of n numbers without using arrays