Collections
- What is the output of this program?
import java.util.*;
public class hashtable_Example
{
public static void main(String args[])
{
Hashtable object = new Hashtable();
object.put("I", new Integer(10));
object.put("L", new Integer(60));
object.put("U", new Integer(25));
System.out.print(object.contains(new Integer(25)));
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Hashtable object object contains values 10, 60, 25 when object.contains(new Integer(25)) is executed it searches for 25 in the hashtable since it is not present true is returned.
- Which of these methods is used to retrieve the elements in properties object at specific location?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
getProperty()
- Which of these is a class which uses String as a key to store the value in object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Properties
- Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Dictionary, Map & Hashtable all implement Map interface hence all of them uses keys to store value in the object.
- Which of these method is used to insert value and its key?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
put()