12:54 am - Thursday July 27, 2017

Check two hashtables are equal boolean equals(Object o)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

                     This function returns true if the object in the map is equal,otherwise returns false.

Example Program


import java.util.Hashtable;

public class HashtableEquals

{

	public static void main(String args[])

	{

		Hashtable htable1 = new Hashtable();

		htable1.put(1, "Add");

		htable1.put(2, "Sub");

		htable1.put(3, "Mul");

		htable1.put(4, "Div");

		Hashtable htable2 = new Hashtable();

		htable2.put(1, "Add");

		htable2.put(2, "Sub");

		htable2.put(3, "Mul");

		htable2.put(4, "Di");

		boolean isequal = htable1.equals(htable2);

		System.out.println("Are two tables equal:" + isequal);

	}

}


Output

Are two tables equal:false

BACK

Filed in: Java Examples

Comments are closed.