📄 testbox.java
字号:
class TestBox
{
static void main(String args[])
{
BasicBox box1 = new BasicBox(4, 5, 6);
BasicBox box2 = new BasicBox(2, 3, 4);
System.out.println("The volume of box1 is " + box1.volume());
System.out.println("The volume of box2 is " + box2.volume());
ColorBox box3 = new ColorBox(10, 20, 30);
ColorBox box4 = new ColorBox(10, 20, 30, "green");
System.out.println(box3);
System.out.println(box4);
BasicBox box5 = new BasicBox(10, 20, 20);
System.out.println(box5);
box5.length = 5000;
System.out.println(box5);
if (box1.equals(box2))
System.out.println("box1 equals box2");
else
System.out.println("box1 does not equal box2");
if (box3.equals(box4))
System.out.println("box3 equals box4");
else
System.out.println("box3 does not equal box4");
ColorBox box6 = new ColorBox(10, 20, 30);
if (box3.equals(box6))
System.out.println("box3 equals box6");
else
System.out.println("box3 does not equal box6");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -