1.

What Is The Output Of This Program? 1. Import Java.util.*; 2. Class Hashtable { 3. Public Static Void Main(string Args[]) { 4. Hashtable Obj = New Hashtable(); 5. Obj.put("a", New Integer(3)); 6. Obj.put("b", New Integer(2)); 7. Obj.put("c", New Integer(8)); 8. System.out.print(obj.contains(new Integer(5))); 9. } 10. }

Answer»

Hashtable OBJECT obj contains values 3, 2, 8 when obj.contains(new Integer(5)) is executed it searches for 5 in the hashtable since it is not present FALSE is returned.

Output:

$ JAVAC hashtable.JAVA
$ java hashtable
false

Hashtable object obj contains values 3, 2, 8 when obj.contains(new Integer(5)) is executed it searches for 5 in the hashtable since it is not present false is returned.

Output:

$ javac hashtable.java
$ java hashtable
false



Discussion

No Comment Found

Related InterviewSolutions