Java examples for Native OS:Shell Command
Pause the program to wait for the user to enter a String and press enter.
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /**// w w w. j ava 2 s . com * Pause the program to wait for the user to enter a String * and press enter. * @return String the user entered */ public static String waitForReadStringAndEnterKeyPress() { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); String s = br.readLine(); return s; } catch (IOException e) { e.printStackTrace(); System.exit(1); } return null; } }