Source code for EqualsMethodExample.java:

public class EqualsMethodExample
{
	public static void main(String args[])
	{
		// EqualsMethodExample
		Integer I1 = new Integer(2);
		Integer I2 = new Integer(2);
		System.out.println("Does I1 equal I2?");
		System.out.println(I1.equals(I2));
	}
}

Output from EqualsMethodExample.java:

Does I1 equal I2? true

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the EqualsMethodExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR