day05-基本类型与引用类型作为方法参数的区别
This commit is contained in:
24
day05/src/com/inmind/array01/Demo10.java
Normal file
24
day05/src/com/inmind/array01/Demo10.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.inmind.array01;
|
||||
/*
|
||||
基本数据类型作为方法参数的操作
|
||||
断点:break point
|
||||
断点使用:在要调用的方法的第一行,点上断点
|
||||
F8:向下执行一行代码
|
||||
F7:进入方法中
|
||||
shift+F8:跳出方法
|
||||
*/
|
||||
public class Demo10 {
|
||||
public static void main(String[] args) {
|
||||
int a = 10;
|
||||
int b = 20;
|
||||
//定义一个方法:alt+enter
|
||||
changeValue(a,b);//基本数据类型作为参数,传递值
|
||||
System.out.println(a);//10
|
||||
System.out.println(b);//20
|
||||
}
|
||||
|
||||
private static void changeValue(int a, int b) {
|
||||
a = a+a;
|
||||
b = b+b;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user