java怎么输入整数
收起
云计算小粉
2018-05-10 20:09:24
1791
0
2
条回答
写回答
取消
提交回答
-
Integer
2019-07-17 22:18:58
-
如果是想通过键盘,输入整数,可以这么写:
public class TestInput {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("please Input an integer");
Long inputNumber = Long.valueOf(br.readLine());
System.out.println("you input: 123" + inputNumber);
}catch (Exception e){
System.out.println("invalid input!");
}
}
}
2019-07-17 22:18:58