문제

I am new to Java ... is there a similar method to the ReadKey() in C# to avoid that a console application closes?

thanks

도움이 되었습니까?

해결책

One way to do it:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();

there are definitely shorter ones, but I think this one's convenient, because it can easily be extended.

다른 팁

YOu can also use System.in.read(), if you are ok with just 'Enter' key being your exit key.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top