SyntaxFix
Write A Post
Hire A Developer
Questions
Java doesn't pass objects, it passes references (pointers) to objects. So yes, l2 and l1 are two pointers to the same object.
You have to make an explicit copy if you need two different list with the same contents.