试题详情
- 单项选择题 Which method implementations will write the given string to a file named "file", using UTF8 encoding?() IMPLEMENTATION a: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.write(msg); fw.close(); } IMPLEMENTATION b: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("file"), "UTF8"); osw.write(msg); osw.close(); } IMPLEMENTATION c: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.setEncoding("UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION d: public void write(String msg) throws IOException { FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION e: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter( new OutputStream(new File("file")), "UTF8" ); osw.write(msg); osw.close(); }
A、Implementation a.
B、Implementation b.
C、Implementation c.
D、Implementation d.
E、Implementation e.
- B
关注下方微信公众号,在线模考后查看
热门试题
- 已知: 要使用类B通过编译,只需要修改
- Given: 11.<% j
- 计算1-123的平方根的倒数之和。
- 程序中怎样控制线程?
- public class&e
- What is th
- You are d
- 打印出所有的"水仙花数",所谓"水仙花数
- 1. public&ensp
- 输入某年某月某日,判断这一天是这一年的第
- 10. public&ens
- 已知菲波纳契数列{X}中,X(1)=0,
- What is th
- int I=1,
- 考虑下面这个简单的例子,让我们看看ref
- 输入一个字符串,其中包含数字、特殊符号(
- 以下涉及到内存管理的代码段中,有错误的是
- public class&e
- Given the&ensp
- Which two,&ensp