public static void main(String[] args) throws IOException {
InputStream istream;
int c;
final int EOF = -1;
istream = System.in;
FileWriter outFile = new FileWriter("C:/Users/boamb/Documents/NetBeansProjects/DSA_BSE20BFT/src/week7/Data.txt",true);
BufferedWriter bWriter = new BufferedWriter(outFile);
System.out.println("Enter fruits to store in data File – Press Ctrl+Z to end ");
while ((c = istream.read()) != EOF)
bWriter.write(c);
bWriter.close();
}
大家好,我试图插入的文件中的数据,通过该系统输出IDE但问题是,当我按CTRL+Z它不工作,该程序仍在运行并且当我停手动有没有任何数据保存在该文件。 这是我的代码。