WHAT IS ARRAY ?

In Java, arrays are objects that store multiple variables of the same type, or variables that are all subclasses of the same type. Arrays can hold either primitives or object references but the array itself will always be an object on the heap.
In array can not expand or contract dynamically as you add or remove elements.

Declaring an Array of Primitives
int[] key; // Square brackets before name (recommended)
int key [];// Square brackets after name

Declaring an Array of Object References
Thread[] threads; // Recommended
Thread threads []; // Legal but less readable

multidimensional array declaration
String[][][] occupantName;
String[] managerName [];

1 comment:

  1. please add some example of array and multidimention array

    ReplyDelete