class TestEntity {
    public int x;
    public int y;
    public TestEntity(int x, int y) {
        this.x = x;
        this.y = y;
    }
    public String toString() {
        return super.toString() + ", x -> " + x + ", y -> " + y;
    }
}
TestEntity t = new TestEntity(666, 777);
List<TestEntity> list = new ArrayList<>();
list.add(t);
t = null;
System.out.println(list.get(0));
why correct print list.get(0) with
@xxxxx,x -> 666, y -> 777
if I remove t = null; and do t.x = 888, the print looks correct.
 
     
    