问题
填空题
某按钮的监视器方法actionPerformed()实现将文本区中的内容写入到文本文件myText.txt中。 public void actionPerformed(ActionEvent e) {
try {
int n = txtFld.getText().length();
byte buffer[]=new byte[n];
buffer=txtFid.getText().getBytes();
FileOutputStream wf=new ________________ ("myText.txt");
wf. write(buffer, 0,n); ________________;
}catch (IOException ioe){
txtFld.setText(ioe.toString());
}
}
}
答案
参考答案:
FileOutputStream
wf.close()