Menu
Question Index
...

What will be the output of the program?

public class Karbon {
    static int i = 5;
    public static void main(String[] args) {
        Karbon test = null;
        System.out.print("i = " + test.i + ", ");
        System.out.print("i = " + Karbon.i);
    }
}


i = 0, i = 5
i = 5, i = 5
Compilation Error
NullPointerException
Runtime Error for some other reason

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