All tutorials are implemented in text (here), and also with exercises and multimedia in the Tutorial Player. The main home page has a search engines, and more facilities.
DefinitionAn array is defined with a type and square brackets as below:
int accountBalances[]; // defines an array of integers
Equivalent is:
float[] accountBalances;
Arrays are automatically initialized if the new method is used:
float[] accountBalances = new Balances[200];
We can also code:
String[] employeeNames = {"John Boron", "Ted Fischer", "Joe Green"}; // this creates an array of three strings.
employeeNames[2] is Joe Green, because the first element is at [0];
You can code an array of arrays:
String[][]
Statements are coded in blocks which start with a { and with a }. {} are called braces. Variables have scope within a block.