So my question is: why assigning at line_2 doesn't affect on the created "test"? Аlthough line-1 affects.
public class Test {
List list;
Test() {
list = new ArrayList();
someVoid(list);
}
void someVoid(List myList) {
myList.add(0); // line 1
myList = null; // line 2
}
public static void main(String[] args) {
Test test = new Test();
System.out.println(test.list.size()); // output: 1 , line 3
}
}