I am surprised to see that getters of height
and width
members has return
type double
, albeit they are int
. Moreover, 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 have a look at Dimension class. Above comment says values cannot go beyond Integer.MAX_VALUE. Why?
Why do we have double
in between? Is there any subtle reason? Can anyone please explain this to me? Sorry for my insistence!
double
asreturn
type? Any use? – Wring