private Student student = new Student();
public Student getStudent(){
return student;
}
public void function(){
getStudent().setName("john");
}
public void function(){
Student student_local = getStudent();
student_local.setName("john");
}
Does GC behave differently for both of the snip?
I mean which case (CASE-1/CASE-2) is more GC efficient in terms of Time?
I simple word GC will be called for CASE-1 or not?