1.

What Is The Output Of This Program? 1. Class Output { 2. Public Static Void Main(string Args[]) { 3. Arraylist Obj = New Arraylist(); 4. Obj.add("a"); 5. Obj.add("d"); 6. Obj.ensurecapacity(3); 7. Obj.trimtosize(); 8. System.out.println(obj.size()); 9. } 10. }

Answer»

trimTosize() is USED to reduce the size of the array that underlines an ARRAYLIST OBJECT.

OUTPUT:

$ javac Output.java
$ java Output
2

trimTosize() is used to reduce the size of the array that underlines an ArrayList object.

Output:

$ javac Output.java
$ java Output
2



Discussion

No Comment Found

Related InterviewSolutions