What will be printed out as a result of the following code compilation and execution?

public class A {

    public static void main(String[] args) {

    static {
Static values initialization blocks are executed whenever the class is loaded for the first time regardless of the main(...) function. Usual initialization blocks are executed only after an instance of a given class is created. Therefore, the "one" string will not be printed out.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback