本文介绍了如何通过Java中的命令行获取输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前有这个代码需要用户输入伪ify发送一些单词并在稍后对整数提交模糊处理。我只需要获得用户输入。任何人都有一个很好的api源来得到这个?我想我应该寻找系统。命令。
I currently have this code that needs user input to pseudo-ify some words to send out and commit obfuscation on the integer later. I just need to get the user input. Anyone have a good source of api to get this from? I think I should be looking for System. commands.
提前致谢:)
推荐答案
Scanner
类在Java 5.0中实现,使输入更容易:
The Scanner
class was implemented in Java 5.0 to make getting input easier:
扫描仪输入=新扫描仪(System.in)
System.in
将允许控制台输入。
Scanner input = new Scanner(System.in)
the System.in
will allow for console input.
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
/* will wait for input then assign it to the variable,
* in this case it will wait for an int.
*/
System.out.println(i); // will print the variable
这篇关于如何通过Java中的命令行获取输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!