函数 --additem() 有 Integer 作为参数,但我不想传递所有整数。我需要发送一个然后调用其他函数。
public void readfile(String fileName) throws FileNotFoundException, IOException {
File file = new File(fileName);
FileInputStream fstream = new FileInputStream(file);
// use DataInputStream to read binary NOT text
// DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
Scanner file2 = new Scanner(br);
while(file2.hasNext()){
String str = file2.nextLine();
String[] spl= str.split(" ");
datas12.add(str);
//System.out.println(str);
for(String line : spl) {
//System.out.println(datas12);
vs = Integer.parseInt(line);
cb.addItem(vs); //Its adding all integers from vs.
}
}
}