Menu
Question Index
...

What will be the output of the following program?

public class Programming {
    static boolean b;
    static int[] ary = new int[1];
    static char chr;
    static boolean[] boolarr = new boolean[1];
    public static void main(String args[]) {
        boolean a = false;
        if (b) {
            a = (chr == ary[chr]);
        } else {
            a = (boolarr[chr] = b);
            System.out.println(a + " " + boolarr[chr]);
        }
    }
}


true true
false false
true false
false true
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