Calling a getter multiple times or calling once and assigning to a variable?

后端 未结 13 1722
无人共我
无人共我 2021-02-05 15:26

say suppose I have class as :

public class Age {

    private int age;

    public int getAge() {
       return this.age;
    }

}

In my Main c

13条回答
  •  无人共我
    2021-02-05 15:41

    i think you will see no difference at runtime - assuming you do not create more than one Age class.

提交回复
热议问题