InputStreamReader或Java I / O控制台 [英] InputStreamReader or Console for Java I/O

查看:133
本文介绍了InputStreamReader或Java I / O控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在Java中获得用户输入,这是更好的方法?

To get user input in Java which is the better method?

reader = new BufferedReader(new InputStreamReader(System.in));



< System.console();

这两者之间的区别是什么,要使用哪一个。

what is the difference between the two and which one is to be used. Or is there any other better method other than these two?

推荐答案

控制台最近被引入Java(Java 6)并更容易地写入命令行。因此,我会使用控制台。

Console was introduced recently to Java (Java 6) to make reading and writing to the command line easier. Therefore, I would use Console.

这篇关于InputStreamReader或Java I / O控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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