Menu
Question Index
...

What will be the output of the following program?

class A {
    public static void main(String arg[]) {
        B a = new B();
        B b = new B();
        B c = new B();
        B d = new B();
        System.out.println("i = " + a.i);
        System.out.println("d = " + b.d);
        System.out.println("c = " + c.c);
        System.out.println("s = " + d.s);
    }
}
class B {
    int i;
    double d;
    char c;
    String s;
}


i = 0
d = 0.0
c =
s = null
Some other output
Output can not determined
Compilation Error or Runtime Error

Doubts

Problems

Topic: Member Variable 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