ARRAYS
A data structure type in which all the elements must be of same type…
OR
It's the collection of finite no of homogenous data element which are stored n consecutive memory locations.
SUBSCRIPT
– It’s also called an index
– It’s the position number in square brackets
– It must be integer or integer expression
a = 5;
b = 6;
c[ a + b ] += 2;
• Adds 2 to c[ 11 ]
• c.length accesses array c’s length
DECLARING AND ALLOCATING ARRAYS
★ Allocated dynamically with operator new
int c[] = new int [12];
★ Equivalent to
Int c[]; //declare array
c = new int [12]; //allocate array
★ We can allocate arrays of objects too
String b[] = new String[ 100 ];