📄 colorbox.java
字号:
/** A descendant of BasicBox which includes a color attribute. The toString
method is changed to display the new color, and a second constructor is added. */
public class ColorBox extends BasicBox
{
/** The color of the box. */
String color;
/** Constructor using the default color. */
public ColorBox(int l, int w, int h)
{
super(l, w, h);
color = "black";
}
/** Constructor for assigning a color. */
public ColorBox(int l, int w, int h, String c)
{
super(l, w, h);
color = c;
}
/** String representation of this box formed by obtaining the BasicBox string
representation and appending a string representation of the color. */
public String toString()
{
String temp = super.toString();
temp += " Color = " + color + "\n";
return temp;
}
/** Does this box have equal variable values as box other? */
public boolean equals(ColorBox other)
{
return super.equals(other) & color.equals(other.color);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -