Menu
Question Index
...

What will be the output of the following program?

public class Sketch {
    static int ad = 100;
    static int bc = 200;
    static {
        ad += 1;
        bc += 1;
    }
    public static void main(String args[]) {
        ad += 5;
        bc += 10;
        System.out.println(ad + bc);
    }
    static {
        ad += 100;
        bc += 200;
    }
}


317
615
617
315
Compilation Error or Runtime Error

Doubts

Problems

Topic: Static Keyword In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App