InterviewSolution
Saved Bookmarks
| 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.tostring()); 9. } 10. } |
|
Answer» obj.toString returns String EQUIVALENT of the HASHTABLE, which can also be obtained by SIMPLY writing System.out.PRINT(obj); as print system automatically coverts the obj to string equivalent. Output: $ JAVAC hashtable.java obj.toString returns String equivalent of the hashtable, which can also be obtained by simply writing System.out.print(obj); as print system automatically coverts the obj to string equivalent. Output: $ javac hashtable.java |
|