Rectangle(int w,int h):width(w),height(h){} 这样定义可以么

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/26 12:00:05
Rectangle(int w,int h):width(w),height(h){} 这样定义可以么

Rectangle(int w,int h):width(w),height(h){} 这样定义可以么
Rectangle(int w,int h):width(w),height(h){} 这样定义可以么

Rectangle(int w,int h):width(w),height(h){} 这样定义可以么
API文档上是这么定义这个类的:
public class Rectangle extends Rectangle2Dimplements Shape, Serializable
Rectangle 指定了坐标空间中的一个区域,通过 Rectangle 对象的左上顶点的坐标(x,y)、宽度和高度可以定义这个区域.
构造方法其中之一是:Rectangle(int x, int y, int width, int height)
构造一个新的 Rectangle(长方形),其左上角被指定为(x,y),而其宽度和高度由同名称的参数指定