I have been in a small argument about the reason to create "getters" inside a class to get the value of a variable inside the class which will be created as an object in our case.
public class big {
  public static void main(String[] args) {
    obj me = new obj();
    int size;
    size = me.size;
    //OR
    size = me.getsize();
  }
}
this is the main class
and i have made 2 methods of getting the "size" of the object
public class obj {
  public static int size = 10;
  public static int getsize() {
    return size;
  }
}
i have done some testing and calling the function seems oddly faster by around 100 nanoseconds. why so?
 
     
    