package com.itcast;
public class Test {
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]);
}
private static void change(int[] arr) {
// TODO Auto-generated method stub
for (int i = 0; i < arr.length; i++) {
if (i%2==0) {
arr[i]*=2;
}
}
}
private static void change(int a, int b) {
// TODO Auto-generated method stub
System.out.println(a + "---" + b);
a = b;
b = a+b;
System.out.println(a + "---" + b);
}
}
|
|