/*
 * Created on 2005-5-12
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.chapter2;

import java.util.List;
import java.util.ArrayList;
/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class IntValue {
	private int iValue ;
	
	public IntValue ( int iValue){
		this.iValue = iValue ;
	}
	
	public int getIValue ( ){
		return this.iValue ;
	}
	
	public boolean equals(Object other){
		if ( other instanceof IntValue){
			IntValue otherVlaue = (IntValue)other ;
			if ( this.iValue == otherVlaue.getIValue()){
				return true ;
			}
		}
		return false;
	}
	public static void main(String[] args) {
		List intList1 = new ArrayList();
		List intList2 = new ArrayList();
		IntValue value1 = new IntValue(99);
		IntValue value2 = new IntValue(99);
		intList1.add(value1);
		intList1.add(value2);
		intList2.add(value1);
		intList2.add(value2);
		
		System.out.println(value1 == value2);
		System.out.println(value1.equals(value2));
		System.out.println(intList1.equals(intList2));
	}
}
