Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java HALP

Name: Anonymous 2011-03-09 18:23

public class life{
    public static void main(){
        char[] alphabet = new char[26];
        for(int i=0;i<26;i++){
            alphabet[i] = ((char)(i+97)); //Sets the lowercase ASCII letter to it's position in the aplhabet
            System.out.println((char)(i+97));//Displays the letter
        }
        System.out.println(alphabet[0] + alphabet[25]);//should return "az"
    }
}

I'm using a for loop to build an array containing the alphabet. It doesn't work.

Name: Anonymous 2011-03-09 19:04

That's because 219 isn't a printable character.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List