day05--基本类型与引用类型作为方法参数的区别_debug说明

This commit is contained in:
2026-09-18 15:02:53 +08:00
parent 298a8addc0
commit f7933d36f9
2 changed files with 43 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package com.inmind.array01;
/*
基本数据类型作为方法参数的操作
断点:break point
断点使用:在要调用的方法的第一行,点上断点
F8:向下执行一行代码
F7:进入方法中
shift+F8:跳出方法
*/
public class Test10 {
public static void main(String[] args) {
//定义2个整数(基本数据类型)
int a = 10;
int b = 20;
//调用一个方法
changValue(a,b);
System.out.println(a);
System.out.println(b);
}
public static void changValue(int a,int b) {
a = a+a;
b = b+b;
}
}
+16
View File
@@ -0,0 +1,16 @@
package com.inmind.array01;
public class Test11 {
public static void main(String[] args) {
int[] arr = {10, 20};
System.out.println(arr);
changeValue(arr);
System.out.println(arr[0]);
System.out.println(arr[1]);
}
private static void changeValue(int[] arr) {
arr[0] = arr[0] + arr[0];
arr[1] = arr[1] + arr[1];
}
}