相关代码 |
|
package demo; import java.util.ArrayList; import java.util.List; public class Arg { private void process(List list1,String name){ process2(list1,name); System.out.println(list1); System.out.println(name); } private void process2(List list1,String name){ list1 = null; name = "hello"; } public static void main(String[] args) { List list1 = new ArrayList(); list1.add("one"); String name = "me"; new Arg().process(list1,name); } }