I tired to find out the precedence order , Wrote following code which is behaving peculiar . I expected answer black but it gives white .
Can any one helps me understanding this .
public class Main {
public static void main(String[] args) {
System.out.println(X.Y.Z); // prints 'White'
}
}
class X {
static class Y {
static String Z = "Black";
}
static C Y = new C();
}
class C {
String Z = "White";
}