Can't Input Last Character; Program Ends Abruptly
import java.io.*;
public class Ascii {
public static void main(String[] args) {
TextReader UserInput = new TextReader(System.in);
System.out.println ("Please type the start character");
char startChar = UserInput.readChar();
System.out.println ("Please type the last character");
char lastChar = UserInput.readChar();
if (lastChar < startChar){
System.out.println ("Error, last character is before start character");
}
for (char ascii = startChar; ascii <= lastChar; ++ascii){
System.out.print (ascii);
}
} // end of main
} // end class
The output of the above code gives me the following:
Please type the start character
a
Please type the last character
Error, last character is before start character
Press any key to continue...
The program doesn't give me time to input the last character. Any suggestions?