- public class Test1 {
- public static void main(String[] args) throws Exception {
- int i = 0;
- show(i);
- System.out.println(i);//0
-
- List<String> list = new ArrayList<String>();
- show(list);
- System.out.println(list);//aaaa
- }
- public static void show(List<String> list) {
- list.add("aaaa");
- }
- public static void show(int i) {
- i = 1;
- }
- }
复制代码 请解释一下区别或是这类问题有什么规律,感谢
|
|