Menu
Question Index
...

What will be the output of the following program?

public class OrangeMangoBanana {
    final static int orange, mango;
    static int banana;
    static {
        mango = orange + 3;
        banana = mango * 2;
    }
    public static void main(String[] args) {
        System.out.print(orange + " " + mango + " " + banana + " ");
        banana = mango + orange + banana;
        System.out.print(banana);
    }
    static {
        orange = 25;
    }
}


25 28 56 109
0 3 6 9
Some other output
Compilation 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