I have a Point. I am trying to get x as an int. If I use Point.x, I will get x as an int. But I am under the impression that I should be using a getter whenever possible (Why use getters and setters?). The issue with Point.getX() is that it returns a double instead of an int.
Which is better, or is it just preference?
a or b?
Point point = new Point(5, 5);
int a = point.x;
int b = (int) point.getX();
I have read Java Point, difference between getX() and point.x, but it did not really answer my question. Or at least I did not understand the answer.