What is the result of the following code execution?
public class Main {
static class X {
static String x = Y.y;
}
static class Y {
static String y = X.x;
}
public static void main(String[] args) {
Y.y = "0";
System.out.println(X.x);
}
}
1) Y.y is firstly initialized with null
2) X.x is initialized with a Y.y value (i.e. with null value)
3) Y.y is initialized with a X.x value (i.e. with null value)
4) After Y.y = "0" value of X.x remains null
So null is the result
Login in to like
Login in to comment