SyntaxFix
Write A Post
Hire A Developer
Questions
Yes, assignment will just copy the value of l1 (which is a reference) to l2. They will both refer to the same object.
l1
l2
Creating a shallow copy is pretty easy though:
List<Integer> newList = new ArrayList<>(oldList);
(Just as one example.)