|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
- 发信人: mask561 (mask), 信区: Java
- 标 题: Re: 怎么接收一个数啊?
- 发信站: BBS 水木清华站 (Thu Aug 8 20:13:40 2002)
- 例如读入一个整数。
- /**
- Reading a int from Standard Input
- */
- import java.io.*;
- public class ReadingInput {
- public static void main(String args[]) {
- int s = 0 ;
- try {
- BufferedReader in = new BufferedReader(new InputStreamReader(System.i
- n));
- String str = "";
- str = in.readLine();
- s = Integer.parseInt(str);
- } catch (IOException e) {
- System.out.println(e.getMessage());
- }
- //System.out.println(s);
- }
- }
- 【 在 kurt0405 (叛逆者之死) 的大作中提到: 】
- : 要在命令行中输入一个数
- : 接收进程序中用
- : 要怎么做啊?
复制代码 |
|