Menu
Question Index
...

What will be the output of the following program?

public class Boolean {
    private boolean myFlag1 = true;
    private static final boolean myFlag2;
    static final double weeks = 9.5;
    protected static final int BOXWIDTH = 42;
    public static void main(String[] arguments) {
        Boolean m = new Boolean();
        System.out.println(m.myFlag1);
        System.out.println(myFlag2);
        System.out.println(weeks);
        System.out.println(BOXWIDTH);
    }
}


true
false
9.5
42
false
false
9.5
42
true
ture
9.5
42
Some other output
Compilation Error or Runtime output

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