equals(Object): This method is available in java.util.Dictionary class of Java.
Syntax:
boolean java.lang.Object.equals(Object obj)
This method takes one argument of type Object as its parameter. This method indicates whether some other object is "equal to" this one.
Parameters: One parameter is required for this method.
obj: the reference object with which to compare.
Returns: true if this object is the same as the obj argument; false otherwise.
Exceptions: NA
Approach
Java
import java.util.Dictionary;import java.util.Hashtable;public class Dictionaryequals {public static void main(String[] args) {Dictionary<String, Integer> dictionary =new Hashtable<String, Integer>();dictionary.put("Hello", 10);dictionary.put("Java", 4);dictionary.put("C++", 17);Dictionary<String, Integer> dictionary2 =new Hashtable<String, Integer>();System.out.println(dictionary.equals(dictionary2));}}
Output:
false
No comments:
Post a Comment