1.Go!!!
以下代码的运行结果是:👇👇👇
import java.util.Arrays; class MyData { int a = 10; } public class Exam { public static void main(String[] args) { int i = 1; String str = "hello"; Integer num = 200; int[] arr = {1,2,3,4,5}; MyData my = new MyData(); change(i,str,num,arr,my); System.out.println("i = " + i); System.out.println("str = " + str); System.out.println("num = " + num); System.out.println("arr = " + Arrays.toString(arr)); System.out.println("my.a = " + my.a); } public static void change(int i, String str, Integer num, int[] a, MyData m){ i += 1; str += "world"; num += 1; a[0] += 1; m.a += 1; } }
具体的代码执行流程,我画了两张图,如下: