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