Java中的Readkey [英] Readkey in Java

查看:400
本文介绍了Java中的Readkey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java新手...是否有与C#中的ReadKey()类似的方法以避免控制台应用程序关闭?

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

谢谢

推荐答案

一种方法:

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.

这篇关于Java中的Readkey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆