Java pass by reference issue with List [duplicate]
问题 This question already has answers here : Is Java “pass-by-reference” or “pass-by-value”? (86 answers) Closed 4 years ago . I am creating ArrayList l1 and passing l1 reference to the method foo. As we know that Java doesn't support Pass-By-Reference but here its giving different results. See the below code public static void main(String[] args) { List l1 = new ArrayList(Arrays.asList(4,6,7,8)); System.out.println("Printing list before method calling:"+ l1); foo(l1); System.out.println(