将ListArrays打印到txt文件

时间:2014-11-23 20:07:53

标签: java arrays

我有一个方法,假设采用3个数组并将它们保存到txt文件。但它没有打印到列表中。这是我的方法代码

public static void saveAndExit(int count, String[] makeArray, String[] moduleArray, double [] msrpArray) throws IOException{
  File carList = new File("cars_list.txt");
  PrintWriter pw = new PrintWriter(carList);
  int index = 0;
  String[] finalMSRPArray = new String[12];
  for (int i = 0; i < msrpArray.length; i++){
      finalMSRPArray[i] = String.valueOf(msrpArray[i]);
  }
    while(count < makeArray.length && count < moduleArray.length && count < msrpArray.length){
        pw.write(makeArray[index]+"\n");
        pw.write(moduleArray[index]+"\n");
        pw.write(finalMSRPArray[index]+"\n");
        index++;
    }

    pw.close();

}

非常感谢任何帮助!

0 个答案:

没有答案