What will print the following code?

public class Quizful {
    static {
        System.out.println("Bo-Bo!");
    }

    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }

static {
        System.out.println("Go-Go!");
        System.exit(0);
    } 
}
Explanation
Static initialization blocks are executed in order of declaration. System.exit(0) terminates the program, status code 0 passed as a parameter means that program exited without errors.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback