public static void main(String[] args) { InputStreamReader ipsReader = new InputStreamReader(System.in); BufferedReader bufReader = new BufferedReader(ipsReader); String string = null; try { string = bufReader.readLine(); while (!string.equalsIgnoreCase("exit")) { System.out.println(string); string = bufReader.readLine(); } } catch (IOException e) { e.printStackTrace(); } }