Values & References6 / 16
Up next

Primitive arguments are copied

class Main {
    static int tryBump(int n) {
        n += 100;
        return n;
    }

    public static void main(String[] args) {
        int x = 1;
        System.out.println(tryBump(x));
        // x is unchanged: it was passed by value
        System.out.println(x);
    }
}
What you're solving

the callee cannot change the caller's int