Core Java Tutorial

Core Java Tutorial

Hashtable Example program for equals(Object o)

[java]
/**
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);
}
}

[/java]

Output:
false