package com.mi.demo3;
class Demo {
public static void main (String[] args) {
int a = 10,b = 20;
change(a, b);
System.out.println("a=" + a + ",b=" + b);
String s1 = "aaa";
String s2 = "bbb";
change(s1, s2);
System.out.println("s1=" + s1 + ",s2=" + s2);
int[] arr = {1, 2, 3, 4, 5};
change( arr );
System.out.println(arr[3]);
}
public static void change(int x, int y){
x = 100;
y = 200;
}
public static void change (String s1, String s2) {
s1 = "java";
s2 = "android";
}
public static void change(int[] arr) {
for (int i=0; i<arr.length; i++) {
arr[i] *= 2;
}
}
}
a=10,b=20
s1=aaa,s2=bbb
8
基本数据类型,修改值后不返回调用的方法
数组不是简单类型