此处无法使用fos.write(Arrays.toString(mark[]));
。我该怎么做才能写出数组值?
class Write {
public static void main(String[] args) {
try {
FileOutputStream fos = new FileOutputStream("D:\\file program\\hai.txt");
String name = Streams.readName();
fos.write(name.getBytes());
fos.flush();
//fos.close();
int[] mark = Streams.readMark();
fos.write(Arrays.toString(mark[]));
fos.flush();
fos.close();
System.out.println("data entred");
} catch (FileNotFoundException ex) {
}
catch (IOException e) {
}
}}
我的输出:
答案 0 :(得分:2)
fos.write(Arrays.toString(mark[]));
不正确
删除 []
然后尝试:
fos.write(Arrays.toString(mark));