Keep the console open after execution (this howto is deprecated)Tag(s): DEPRECATED
Call the static method PressAnykey to keep to "DOS" window open.
import java.io.*;
public class IO {
public static void PressAnyKey() {
BufferedReader input =
new BufferedReader(new InputStreamReader(System.in));
System.out.print("Press any key...");
try { input.readLine();}
catch (Exception e) { e.printStackTrace();}
}
}public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world.");
IO.PressAnyKey();
}
}
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com