Menu
Question Index
...

What will be the output of the following program?

public class XYZ {
    public static void main(String[] args) {
        System.out.println(X.Y.Z);
    }
}
class X {
    static class Y {
        static String Z = "Black";
    }
    static C Y = new C();
}
class C {
    static String Z = "White";
}


White
Black
BlackWhite
WhiteBlack
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Calling A Class From Another Class 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