Skip to main content

Posts

Showing posts with the label array

ARRAY vs ARRAYLIST

ARRAY vs ARRAYLIST Array is an object used to save similar data type elements and its size is limited . Array is static in nature. Once created we cannot change size of array. ·        Random access, linear data structure ·        Fixed size once created ·        Can contain objects and primitives ·        Must declare element type ·        It is not a class ·        Elements accessible with index number Eg: int[] ar=new int[3]; //stores complete integer types Arraylist is a part of Collection Framework of util package to store different data type objects and it is growable . Arraylist is dynamic in nature. It can be re-size itself when needed depending upon capacity and load factor. ·        Random access, linear data structure ·        Dynamic size, grows automatically ·        Can only contain objects ·        Element type   is OBJECT ·        It is a class with many methods ·        Accessing methods like get() etc are ava