1.

What Is The Output Of This Program? 1. Import Java.util.*; 2. Class Maps { 3. Public Static Void Main(string Args[]) { 4. Treemap Obj = New Treemap(); 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.entryset()); 9. } 10. }

Answer»

obj.entrySet() method is used to obtain a set that contains the ENTRIES in the MAP. This method PROVIDES set view of the invoking map.

Output:

$ javac MAPS.java
$ java Maps
[A=1, B=2, C=3]

obj.entrySet() method is used to obtain a set that contains the entries in the map. This method provides set view of the invoking map.

Output:

$ javac Maps.java
$ java Maps
[A=1, B=2, C=3]



Discussion

No Comment Found

Related InterviewSolutions