Order of the initialization in Java
<p>I know, it's a very basic topic, so if it is a duplicate question, please provide a reference.</p>

<p>Say, there is a following code:</p>

<pre><code>public class Point {

    int x = 42;
    int y = getX();

    int getX() { 
        return x; 
    }

    public static void main (String s[]) {
        Point p = new Point();
        System.out.println(p.x + "," + p.y);
    }
} 
</code></pre>

<p>It outputs: <code>42,42</code></p>

<p>But if we change the order of the appearance of the variables: </p>

<pre><code>public class Point {

    int y = getX();
    int x = 42;

    int getX() { 
        return x; 
    }

    public static void main (String s[]) {
        Point p = new Point();
        System.out.println(p.x + "," + p.y);
    }
} 
</code></pre>

<p>It outputs: <code>42,0</code></p>

<p>I understand that in the second case the situation can be described as something like: "Okay, I don't know what the returned x value is, but there is some value". What I don't completely understand is how x may be seen here without being seen along with its value. Is it a question of compile time and run time? Thanks in advance.</p>
