Monday, October 6, 2008

Get the Alphabet with Java!

This may be an embarrassing thing to admit, but I was momentarily stumped this morning when I had a need to iterate over the English alphabet with Java 1.5 ... I've been a Sun Microsystems Certified Java Programmer for 3 years now, yet this little thing got me!

Well, here's my solution, which I'm posting up now in hopes that someone with the same need may do a google search and find this post =)

char letter;
for (letter='a'; letter <= 'z'; letter++) { System.out.println( letter ); }


Simple, right!?

If you find this helpful, please leave a comment and let me know!