当前位置: 技术问答>java相关
i/o一题??????????????????????
来源: 互联网 发布时间:2015-03-13
本文导语: // Point X public class qq { public static void main(String[] args) throws Exception { PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true); out.println("hello"); } } which statement at PointX on line 1 allows this code to...
// Point X
public class qq
{
public static void main(String[] args) throws Exception {
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);
out.println("hello");
}
}
which statement at PointX on line 1 allows this code to compile and run?
a.import java.io.PrintWriter;
b.include java.io.PrintWriter;
c.import java.io.OutputStreamWriter
d.include java.io.OutputStreamWriter
e.no statement is needed
我对
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);
这句话不太了解???
public class qq
{
public static void main(String[] args) throws Exception {
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);
out.println("hello");
}
}
which statement at PointX on line 1 allows this code to compile and run?
a.import java.io.PrintWriter;
b.include java.io.PrintWriter;
c.import java.io.OutputStreamWriter
d.include java.io.OutputStreamWriter
e.no statement is needed
我对
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);
这句话不太了解???
|
public PrintWriter(OutputStream out,
boolean autoFlush)
Create a new PrintWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.
Parameters:
out - An output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer
boolean autoFlush)
Create a new PrintWriter from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding.
Parameters:
out - An output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer
|
应该选a。PrintWrite是write类的子类,用于将数据送入字符输出流。
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);是新建一个PrintWrite的对象,该对象基于System.out流。
PrintWriter out =new PrintWriter(new java.io.OutputStreamWriter (System.out),true);是新建一个PrintWrite的对象,该对象基于System.out流。
|
a正确无误,逐个拆分,找他们的API!
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。