The output of this program is 5. Why is that the case? Why isn't the output 6? How to write a method that will actually add value to x? Thanks.
public static void main (String args []) {
int x = 5;
example (x);
System.out.println(x);
}
public static void example (int x) {
x = x + 1;
}