public class W09N02 { public void m1(int len) { // delclare array of chars char[] ca; ca = new char[len]; // loop and initialize array for(int i=0; i < len; i++) { // 0 = 'a', 1 = 'b' ... // 'a' is char number 97 (from ascii table // (int)'a' -- means convert 'a' from a char to its // ascii equivalent, so (int)'a' is the int 97 // now add the value of i to 97 and convert the result // back to a char and assign this char to the bucket // at index i in the array ca ca[i] = (char)((int)'a' + i); } // loop and print // notice, the printing could have been done in the // initialization loop above System.out.println("Array contains the following:"); for(int i=0; i < len; i++) { System.out.println("index " + i + " == " + ca[i]); } } }