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

What is the output of the program?

public class Calculator {
    int result = 0;

    void add(int value){
        result += value;
    }

    void subtract(int value){
        result -= value;
    }

    public static void main(String[] args) {
        Calculator calc = new Calculator();
        calc.add(10);
        calc.subtract(5);
        System.out.println(calc.result);
    }
}