// GetNext.java: fetch the next char or int from standard input import java.io.*; public class GetNext { // in: reader for reading input data private static Reader in = new InputStreamReader(System.in); // ch: holds the next character read private static char ch; public static char getNextChar() { try { ch = (char)in.read(); } catch (Exception exception) { System.out.println("Error reading character"); ch = ' '; } return ch; } }