0
public static void main(String[] args) {
    int number = 3;
    modifyNumber(number);
    System.out.println(addAndReturn(number));
}

public static void modifyNumber(int number) {
    number = number + 2;
}

public static int addAndReturn(int number) {
    return number + 10;
}

I reviewed the code many times but i still don't understand it. The method "modifyNumber" doesn´t create a variable inside itself so, shouldn't it actually modify the main method's number variable?

0 Answers0