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");
}
}
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
Post a Comment