下列程序的功能是将一个整数数组写入二进制文件,在程序的下画线处应填入的选项是( )。 i mport java.io .*; public class XieShuzu { public static void mai n(Stri ng[]a){

admin2012-12-02  53

问题 下列程序的功能是将一个整数数组写入二进制文件,在程序的下画线处应填入的选项是(  )。
i mport java.io .*;
public class XieShuzu {
public static void mai n(Stri ng[]a){
  i nt []myArray =(10,20,30,40);
  try {
   DataOutputStreamdos =
ne w DataOutputStream(ne w
     FileOutput Stream("i nts .dat"));
   for (i nt i =0;i <myArray .length ;i ++)
    dos .(myArray[i]);
   dos .close();
   Syste m.out .pri ntln ("已经将整数数组写入二进制文件:i nts .dat");
  }catch (IOException ioe)
   {Syste m.out .pri ntln("IO Excepr_on");



选项 A、write Array
B、writeByte
C、writeInt
D、writeDouble

答案C

解析 向流中写入整数数组,用Wri nteInt方法。
转载请注明原文地址:https://kaotiyun.com/show/h9ID777K
0

相关试题推荐
最新回复(0)