Skip to content
CodeKruPro

A local variable with the same name as a field

Predict the outputEasyJava only
Main.java
public class Main {
    static int x = 10;

    public static void main(String[] args) {
        int x = 5;
        System.out.println(x);
        System.out.println(Main.x);
        System.out.println(x + Main.x);
    }
}

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.