I'm a Java novice with a little problem. My program reads a string, then a
character, then a string from the keyboard. On
the second string the program fails to pause for keyboard input. The problem
goes away if the character reading code is
commented out. The code follows. What am I doing wrong? The code follows.
import java.io.*;
class Whatever
{
public static void main( String [] args ) throws IOException
{
BufferedReader in = new BufferedReader( new
InputStreamReader(System.in));
/* Read first string */
System.out.print( "Enter any number: " );
String input = in.readLine();
double num1 = Double.parseDouble( input );
/* Read a character */
System.out.print( "Enter a letter: " );
char letter = ( char ) in.read();
System.out.println( letter );
/* Read second string */
System.out.print( "Enter an integer " );
input = in.readLine();
System.out.println( input );
int num2 = Integer.parseInt( input );
} // end method main
} // end class PayCalculator