⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testequality.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
public class TestEquality
{
	static void main(String[] args) throws Exception
	{
		VeryBasicBox box1 = new VeryBasicBox(4, 5, 6);
		VeryBasicBox box2 = new VeryBasicBox(2, 3, 4);
		System.out.println("The volume of box1 is " + box1.volume());
		System.out.println("The volume of box1 is " + box2.volume());
		
		if (box1.equals(box2))
			System.out.println("box1 and box2 have equal length, width and height.");
		else
			System.out.println("box1 and box2 do not have equal length, width and height.");
			
		if(box1 == box2)
			System.out.println("box1 and box2 are the same object");
		else 
			System.out.println("box1 and box2 are not the same object");
			
		VeryBasicBox box3 = new VeryBasicBox(2, 3, 4);
		if (box2.equals(box3))
			System.out.println("box2 and box3 have equal length, width and height. ");
		else
			System.out.println("box2 and box3 do not have equal length, width and height.");
		if (box2.equals(box2))
			System.out.println("box2 equals box2");
		else
			System.out.println("box2 does not equal box2");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -