填空题
某按钮的监视器方法actionPerformed1实现将文本区中的内容写入到文本文件myText.txt中。
public void actionPerformed(ActionEvent e) {
try {
int n = txtFld.getText2.length3;
byte buffer[]=new byte[n];
buffer=txtFid.getText4.getBytes5;
FileOutputStream wf=new 6 ("myText.txt");
wf. write(buffer, 0,n);
7;
}catch (IOException ioe){ txtFld.setText(ioe.toString8); }
}
}
【正确答案】
1、FileOutputStream
wf. close---|||________|||---
【答案解析】