الرجوع
تسجيل الدخول

What will be the output of this code?

public class Number {
    static int x = 10;

    public static void increment() {
        x++;
    }

    public static void main(String[] args) {
        Number n1 = new Number();
        Number n2 = new Number();
        n1.increment();
        n2.increment();
        System.out.println(Number.x);
    }
}