import java.util.*;
public class Main {
private static int call(int n) {
n = n - 1;
return n;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = 5;
call(n);
System.out.println(n);//output is still 5;
}
}
how to change the value of n using call method? I did using void on call method like we use for integer array but that is also not working.