Well, I know what they do according to my experience and the Oracle Java API documentation, but I wonder why. Through the constructor, I am allowed to pass arguments of type int to the Rectangle class, the internal representation of the data x, y, etc. It is of type int , and also setSize() only with the exception of arguments of type int . But why all methods, such as getX() , getY() , getWidth() , etc., return double when there can be no precision? Why not a simple int as expected?
EDIT: I understand that it is derived from the Rectangle2D class, but this is still not justification for simply not providing any int - getX() and getY() functions, as opposed to Point and Point2D These methods are not abstract. In addition, setLocation() also not abstract.
Jori
source share