当前位置: 技术问答>java相关
如何从键盘读入一个double或int型数组??(高分!!)
来源: 互联网 发布时间:2015-08-24
本文导语: 十万火急!!! | 如果每行输入数组的一个数: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList al = new ArrayList(); String line = reader.readLine(); while(line != null) { al.a...
十万火急!!!
|
如果每行输入数组的一个数:
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList al = new ArrayList();
String line = reader.readLine();
while(line != null) {
al.add(new Double(line));
line = reader.readLine();
}
int size = al.size();
double[] ret = new double[size];
for(int i=0;i
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList al = new ArrayList();
String line = reader.readLine();
while(line != null) {
al.add(new Double(line));
line = reader.readLine();
}
int size = al.size();
double[] ret = new double[size];
for(int i=0;i