import java.io.*; public class Keyboard { public static char readchar() { int i = 0; try { i = System.in.read(); } catch ( IOException iox ) { System.out.println( "there was an error: " + iox ); } return (char)i; } // end of readchar() public static String readline() { InputStreamReader isr = new InputStreamReader( System.in ); BufferedReader stdin = new BufferedReader( isr ); String s = null; try { s = stdin.readLine(); } catch( IOException iox ) { System.out.println( "there was an error: " + iox ); } return s; } // end of readline() public static void main( String[] args ) { // read one char System.out.print( "enter a character: " ); char c = readchar(); readline(); // flush remaining chars from the input stream System.out.println( "you entered: " + c ); // read one line System.out.print( "enter a line: " ); String line = readline(); System.out.println( "you entered: " + line ); } // end of main() } // end of class Keyboard