1-1-10-18 怎么接收一个数啊?
发信人: mask561 (mask), 信区: Java
标题: Re: 怎么接收一个数啊?
发信站: BBS 水木清华站 (Thu Aug8 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 (叛逆者之死) 的大作中提到: 】
: 要在命令行中输入一个数
: 接收进程序中用
: 要怎么做啊?
页:
[1]