This question is a continuation of this , but requires a more specific scenario.
Suppose we have the following class:
public class Person {
private Foot left, right;
public Person(Foot left, Foot right) {
this.left = left;
this.right = right;
}
}
I was wondering if the next class could be optimized from the point of view of the GC if we turned it into the following:
public class Person {
private final Foot left, right;
public Person(Foot left, Foot right) {
this.left = left;
this.right = right;
}
}
, , . , , GC ( ) , , Person . , Foot; .
, , , ( )?