我在将用户输入的二维数组写入文本文件时遇到问题。到目前为止,我的代码(至少在 Saving 方法中)是:
`public static void Save(String[][] EntryList)
{
try {
String[][] content = EntryList;
File file = new File("CBB.dat");
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
InputStream instream;
OutputStream outstream;
instream = new DataInputStream( new BufferedInputStream(new FileInputStream(file))); // buffers the data stream
outstream = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(file)));
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter writer = new BufferedWriter(fw);
for (int row = 0; row < EntryList.length; ++row)
{
outstream.writeUTF(EntryList[row][1]);
outstream.writeUTF(EntryList[row][2]);
outstream.writeUTF(EntryList[row][3]);
outstream.writeUTF(EntryList[row][4]);
outstream.writeUTF(EntryList[row][5]);
}
outstream.close();
}catch (IOException e) {
e.printStackTrace();
}
}`
但是,当我尝试编译时,我收到 Java“找不到符号 - 方法 WriteUTF(String)”的错误