InterviewSolution
Saved Bookmarks
| 1. |
What Is The Output Of This Program? 1. Import Java.util.*; 2. Class Maps { 3. Public Static Void Main(string Args[]) { 4. Hashmap Obj = New Hashmap(); 5. Obj.put("a", New Integer(1)); 6. Obj.put("b", New Integer(2)); 7. Obj.put("c", New Integer(3)); 8. System.out.println(obj.keyset()); 9. } 10. } |
|
Answer» keySet() method returns a set containing all the KEYS USED in the invoking map. Here keys are characters A, B & C. 1, 2, 3 are the values given to these keys. Output: $ JAVAC Maps.java keySet() method returns a set containing all the keys used in the invoking map. Here keys are characters A, B & C. 1, 2, 3 are the values given to these keys. Output: $ javac Maps.java |
|