How do you keep the console from closing after the program is done?

mikigal picture mikigal · Oct 30, 2015 · Viewed 12.1k times · Source

How do you keep the console from closing after the program is done in Java?

Answer

Willi Mentzel picture Willi Mentzel · Nov 1, 2015

readLine() waits until you press a key:

public static void main (String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    in.readLine();
}