FileDocCategorySizeDatePackage
CompareObjects.javaAPI DocExample1235Sun Oct 28 12:40:18 GMT 2001myprojects.compareobjects

CompareObjects

public class CompareObjects extends Frame

Fields Summary
Constructors Summary
public CompareObjects()

		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				dispose();
				System.exit(0);
			}
		});
	
Methods Summary
public static voidmain(java.lang.String[] args)

		System.out.println("Starting CompareObjects...");
		Room r1 = new Room();
		Room r2 = new Room();
		
		String s1;
		String s2;
		s1 = new String("Hello world");
		s2 = s1;
		System.out.println(s2);
		if(s1 == s2) System.out.println("s1 and s2 refer to the same object");
		
		
		// set up a room of 4 by 3 metres
		r1.setSize(4.0, 3.0);
		r2.setSize(2.0, 6.0);
		if(r1.compareSize(r2)) {
			System.out.println("Rooms r1 and r2 the same size");
		} else {
			System.out.println("Rooms r1 and r2 not the same size");
		}