当前位置:SCJP程序员认证考试题库

问题:

[单选]

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.

改革开放后,中国学前美术教育开始注意到哪些方面的问题? 简答捷克教育家夸美纽斯的学前教育主张。 清代官员品级不同,其帽纬颜色也不相同,以下哪种颜色是一品及二品官员帽纬颜色() 红色。 蓝色。 白色。 金色。 ()就是要以财物作质押,有偿有期借贷融资的一种方式。 消费金融公司。 保险公司。 典当。 同业拆借。 对物证的审查和判断可以从以下几个方面进行()。 审查认定物证的来源是否合法。 认真仔细地审查物证的外部特征,以确定其同案件事实的关联性。 审查物证上是否有文字、图形,并确定其内容与案件的联系。 审查证人对物证的陈述。 采用交付辩认、技术鉴定和比较印证等方法,来审查判断物证。

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();  
}  

参考答案:

  参考解析

本题暂无解析

在线 客服