Skip to main content

Posts

Showing posts with the label collection framework part second

Core java collection framework interview questions and answers second part...

                                            1: which classes of collection framework that takes only homogeneous (same type) objects only. Ans: Only there are two classes that takes homogeneous elements those are TreeSet and TreeMap.                                                   2: How ArrayList work's internally? Ans:             Example :       ArrayList :     | 1 | 5 | 6 | 9 | 4 | 5 | 2 | 11 |      Size : 8      index : 0 - 7 arraylist is same as an array but it's dynamic array so, it increases it's size when required.    when you create a arraylist object initially it's size will be 10, and as you inter any value that  will go in in index 0 , and it's the starting index.      in the above example we have an arraylist that contains 8 elements and new it's full so if we try to insert more element in this list then automatically JVM create a new ArrayList and Copy all the data from this list and past it into the newly created list. and the size of the new l