//断点调试,记住:方法中的变量在调用完之后会消失 package cn.debug; public class DuanDian { public static void main(String[] args) { int a = 10; int b = 20; System.out.println(a + "-----" + b); change(a, b); System.out.println(a + "-----" + b); int[] arr = { 1, 2, 3, 4, 5 }; change(arr); System.out.println(arr[1]); } public static void change(int a, int b) { a = b; b = a + b; System.out.println(a + "-----" + b); } public static void change(int[] arr) { for (int i = 0; i < arr.length; i++) { if (arr[i] % 2 == 0) { arr[i] = arr[i] * 2; } } } }
时间: 2024-10-07 14:10:05