package array; public class FcuntionDemo3 { public static void main(String[] args) { int a = 10; change(a); System.out.println(a + " ---> line 7"); } public static void change(int a) { System.out.println(a + " ---> line 11"); a = 20; System.out.println(a + " ---> line 13"); } }
package array; public class FunctionDemo4 { public static void main(String[] args) { int[] arrs = {10, 20, 30}; change(arrs); System.out.println(arrs[1] + " ----> line 7"); } public static void change(int[] arrs) { System.out.println(arrs[1] + " ----> line 11"); arrs[1] = 222; System.out.println(arrs[1] + " ----> line 13"); } }