12:35 am - Tuesday August 21, 2018

Hashtable Example program for 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
/**
Author :candidjava.com
Description: Compares the specified Object with this Map for equality, as per the definition in the Map interface
/*
import java.util.*;
import java.util.Hashtable;
import java.io.IOException;
public class HashtableEqualsExample
{
public static void main(String args[])throws IOException
{
int s=33, s1=44,s2=55;
boolean b;
Hashtable h=new Hashtable();
h.put(1,s);
h.put(2,s1);
h.put(3,s2);
b=h.equals(s)   //the hash value compares  and its results is equals means true elz false
System.out.println(b);
}
}

Output:
false

Filed in: Core Java Tutorial

Comments are closed.