|
Keep the console open after execution |
|
|
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();
}
}
}
|
For example
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world.");
IO.PressAnyKey();
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.