3. Container for holding multiple data elements – primitives or object together Efficiently store and randomly access data elements Arrays in Java are first class objects Fixed size once created Can only store data elements of only one kind Accessed with index Index starts at 0 and ends at size – 1 Array size is given by a special field called length What are arrays?
4. int a [] = newint[3]; int b[] = {1,2,3,4}; long c [] = new long[12]; Integer d[] = new Integer[4]; All one dimensional arrays Declare array
5. a[0] = 1, a[1] = 2, a[2] = 3; System.out.println(b[2]); System.out.println(b.length); d[0] = new Integer(5); d[1] = new Integer(88); Traversing array Next Session Play with array