Listing the alphabet (beginner)
Hello.
I am currently trying to do an assignment right now and I have no idea if I'm doing it right or not. The assignment is:
Write a JAVA program that uses the ASCII codes and a for loop in a METHOD Alphabet() to display the alphabet in the following format:
UPPERCASE LOWERCASE
A a
B b
C c
. .
. .
. .
Z z
This is all I have so far.
Code:
{
public static void main( String args[] )
{
char upper;
char lower;
System.out.printf( "%s%20s\n", "UPPERCASE", "LOWERCASE");
for ( upper = 'A'; upper <= 'Z'; upper++ )
{
System.out.print(upper);
System.out.println();
}
}
}
I don't even think this is correct but I can at least get the first row of uppercase letters down. Can someone help me set up the lowercase letters in the format that I was told to do? Oh and there is a big space between the two rows, just for some reason I can't set up the spaces while posting.
Thanks in advance.