Arrays
Arrays
Arrays
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Use:<br />
[]<br />
• index is an integer expression that satisfies the following relation:<br />
0 ≤index < numOfElements<br />
– 0 and (numOfElements-1) are lower and upper limits for index, respectively.<br />
– The value of the index is checked automatically during execution.<br />
–If index ≥ numOfElements or index < 0, an ArrayIndexOutOfBoundsException is<br />
thrown at runtime.<br />
• Notation above can interpreted as variable:<br />
– a[2] indicates the 3rd element in the array a.<br />
a[2] = 5;<br />
a[2] = 3 * a[2]; // a[2] is assigned the value 15.<br />
Java Actually 6: <strong>Arrays</strong> 6-6/20