1.

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

Answer»

OBJ.keySet() returns a set containing all the keys USED in properties object, here obj contains keys AB, BC, CD therefore obj.keySet() returns [AB, BC, CD].

OUTPUT:

$ javac properties.JAVA
$ java properties
[AB, BC, CD]

obj.keySet() returns a set containing all the keys used in properties object, here obj contains keys AB, BC, CD therefore obj.keySet() returns [AB, BC, CD].

Output:

$ javac properties.java
$ java properties
[AB, BC, CD]



Discussion

No Comment Found

Related InterviewSolutions