import java.io.*; public class ConsoleIOExample { public static void main (String[] args) { System.out.println("Type some text and hit 'Enter.'"); String string = ""; InputStreamReader input = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(input); // read in user input try { string = reader.readLine(); System.out.println("You typed: " + string); // keep console window open until 'Enter' is pressed reader.readLine(); } catch(Exception e) { } } }