I am surprised to see that the getters of the height and width members have a return type double , although they are int . Moreover, the setSize method with double parameters has the following definition:
/** * Sets the size of this <code>Dimension</code> object to * the specified width and height in double precision. * Note that if <code>width</code> or <code>height</code> * are larger than <code>Integer.MAX_VALUE</code>, they will * be reset to <code>Integer.MAX_VALUE</code>. * * @param width the new width for the <code>Dimension</code> object * @param height the new height for the <code>Dimension</code> object */ public void setSize(double width, double height) { this.width = (int) Math.ceil(width); this.height = (int) Math.ceil(height); }
Please review the Dimension class. Above the comment says that values cannot go beyond Integer.MAX_VALUE. What for? Why do we have double between? Is there any subtle reason? Can anyone explain this to me? Sorry for my persistence!
java double dimension awt
Ahamed
source share