Streets.java
1    package arrayplay;
2    
3    public class Streets {
4        public static void main(String[] args) {
5            String[] streets = new String[12];
6    
7            streets[0] = "Iberville";
8            streets[1] = "Decatur";
9            streets[2] = "Toulouse";
10           streets[3] = "Bourbon";
11           streets[4] = "Dauphine";
12           streets[5] = "Royal";
13           streets[6] = "St Ann";
14           streets[7] = "St Peter";
15           streets[8] = "Conti";
16           streets[9] = "Exchange";
17           streets[10] = "Bienville";
18           streets[11] = "Dumaine";
19   
20           System.out.println("length of streets array = " + streets.length);
21           System.out.println("first street = " + streets[0]);
22           System.out.println("last street = " + streets[11]);
23           System.out.println("last street = " + streets[streets.length-1]);
24   
25           System.out.println("\nThe initial array ...");
26           int i = 0;
27           while (i < streets.length) {
28               System.out.println(streets[i]);
29               i = i + 1;
30           }
31   
32           String temp = streets[0];
33           streets[0] = streets[streets.length-1];
34           streets[streets.length-1] = temp;
35   
36           System.out.println("\nThe final array ...");
37           for (int x = 0; x < streets.length; x = x + 1 ){
38               System.out.println(streets[x]);
39           }
40   
41       }
42   }
43