What happens when you compile and run the following code?

public class Test {

    static int[] arrInstance = new int[100];

    public static void main(String[] args) {
        byte[] arrLocal = new byte[100];

        for (int i = 0; i < 100; i++)
            if (arrInstance[i] != arrLocal[i]) {
                throw new IllegalStateException("error");
            }
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes