单选题现有:  String s="write a line to a file";     w.print(s+"/n");      哪一个是对的?()Aw即可以是PrintWriter类型,也可以足BufferedWriter类型。Bw即不可以是PrintWriter类型,也不可以足BufferedWriter类型。Cw可以是BufferedWriter类型,但不可以是PrintWriter类型。D w以是PrintWriter类型,但不可以是BufferedWriter类型。

单选题
现有:  String s="write a line to a file";     w.print(s+"/n");      哪一个是对的?()
A

w即可以是PrintWriter类型,也可以足BufferedWriter类型。

B

w即不可以是PrintWriter类型,也不可以足BufferedWriter类型。

C

w可以是BufferedWriter类型,但不可以是PrintWriter类型。

D

 w以是PrintWriter类型,但不可以是BufferedWriter类型。


参考解析

解析: 暂无解析

相关考题:

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first

现有:Strings=writealinetoafile;w.print(s+\n);哪一个是对的?() A.w即可以是PrintWriter类型,也可以足BufferedWriter类型。B.w即不可以是PrintWriter类型,也不可以足BufferedWriter类型。C.w可以是BufferedWriter类型,但不可以是PrintWriter类型。D.w以是PrintWriter类型,但不可以是BufferedWriter类型。

Given:Which regular expression, inserted at line 12, correctly splits test into Test A, Test B, and Test C?() A.String regex=;B.String regex= .;C.String regex=.*;D.String regex=\\s;E.String regex=\\.\\s*;F.String regex=\\w[\.]+;

下列的哪个程序段可能导致错误? ( )A.String s="hello"; String t="good"; String k=s+t;B.String s="hello"; String t; t=s[3]+"one";C.String s="hello"; String standard=s.toUpperCase();D.String s="hello"; String t=s+"good";

下列哪个程序段可能导致错误?A.String s="hello"; String t= "good"; String k=s+ t;B.String s="hello"; String t; t=s[3]+"one";C.String s="hello"; String standard=s. toUpperCaseD.String s="hello"; String t =s+ "good"

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }A.String:Stringfirst,int:11B.int:11,String:Int firstC.String:String first,int:99D.int:99,String:int first

有以下程序 int a=3; main() { int s=0; { int a=5;s+=a++;} s+=a++; printf("%d\n",s); } 程序运行后的输出结果是______。A.8B.10C.7D.11

有以下程序#include stdio.hmain( ){ int s=0,n;for( n=o;n3;n++){ switch(s){ case 0:case 1: s+=1;case 2: s+=2; break;case 3: s+=3;default: s+=4;}printf(”%d,”,s);}}程序运行后的输出结果是A)1,2,4,B)1,3,6,C) 3,10,14,D) 3,6,10,

2下列程序的执行结果是( )。 public class ex68 { public static void main(String[] args) { ex68 bj=new ex680; int s=0; for(int i=1; i<=4; i++){ s+=obj.method(i); } System.out.println(s); } public int method(int n) { if(n==1) return 1; else tatum n * method(n-1); } }A.3B.9C.33D.153

下列程序的执行结果是 ( ) public class ex68{ public static void main(String[]args){ ex68 obj=new ex68(); int s=0; for(int i=1;i<=4;i++){ s+=obj.method(i); } System.out.println(s); } public int method(int n){ if(n==1) return 1; else return n*method(n-1); } }A.3B.9C.33D.153

执行以下的循环后输出的值为( )。 public class Sun { public static void main(String args[ ]) { int m=1000,s=0,n=0; do{ n=n+1; s=s+(int)Math.pow(2,n); }while(s<=m); System.out.println("n="+n+","+"s="+s); } }A.n=9,s=1000B.n=8,s=1022C.n=9,s=1022D.n=8,s=1000

下列给定程序中,函数fun()的功能是;将s所指字符串中的字母转换为按字母序列的后续字母(但Z转化为A,z转化为 a),其他字符不变。请改正函数fun()中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <stdio.h>include <ctype.h>include <conio.h>void fun(char *s)/*************found**************/{ while(*s!='@'){ if(*s>='A' *s<='z'||*s>='a'*s<='z'){if(*s=='Z') *S='A';else if(*S=='z') *s='a';else *s+=1;}/*************found**************/(*s)++;}}main(){ char s[80];clrscr();printf("\n Enter a string with length <80:\n\n");gets(s);printf("\n The string:\n\n");puts(s);fun(s);printf("\n\n The Cords:\n\n");puts(s);}

下面的表达式中正确的是 ( )A.String s=“你好”;int i=3;s+=i;B.String s=“你好”;int i=3;if(i==s){s+=i};C.String s=“你好”;int i=3;s=i+s;D.String s=“你好”;int i=3; s=i+;

3下列程序段运行的结果为( )。 public class Test{ static void print(String s,int i){ System.out.pdntlnC String: "+s+",int:"+i); } static void print(iht i,String s){ System.out.prinflnCint:"+i+",gtring:"+s); } public static void main(String[] args){ print(99,"Int first"); } }A.String:String first,int: 11B.int: 11,String:Int firstC.String:String first,int:99D. int:99,Stfing:Int first

有以下程序:includemain(){int s=0,a=1,n; scanf("%d",n); do {s+=1;a=a-2;} whi 有以下程序: #include <stdio.h> main() { int s=0,a=1,n; scanf("%d",n); do {s+=1;a=a-2;} while(a!=n); printf("%d\n",s); } 若要使程序的输出值为2,则应该从键盘给n输入的值是( )。A.-1B.-3C.-5D.0

若输入 "I am a boy!",下列程序的运行结果为______。 char connect(string1,string2,string) char string1[],string2[],string[]; { int i,j; for (i=0;stringl[i] !='\0';i++) string[i]=stringl[i]; for (j=0;string2[j] !='\0';j++) string[i+j]=string2[j]; string[i+j ] ='\0'; } main ( ) { char s1 [100] , s2 [100] , s [100]; printf ("\n 输入 string1: \n"); scanf("%s",s1); printf (" \n 输入 string2: \n" ); scanf ("%s", s2); connect (s1, s2, s); printf ("%s\n", s); }A.I am a boy!B.输入string2:C.I amD.I am a boy!

现有:      class Pencil  {  public void write (String content){  System.out.println ("Write"+content);     }     }  class RubberPencil extends Pencil{     public void write (String content){  System.out.println ("Rubber Write"+content);     }  public void erase (String content){     System.out.println ("Erase "+content);     }     } 执行下列代码的结果是哪项?()  Pencil pen=new RubberPencil();      pen.write("Hello");     A、  Write HelloB、  Rubber Write HelloC、编译错误D、运行时抛出异常

有语句String s=”hello world”; ,以下操作哪个是不合法的()A、int i=s.length();B、s=3;C、String ts=s.trim();D、String t=s+”!”

现有:      class Pencil  {  public void write (String content){     System.out.println( "Write",+content){     }     }class RubberPencil extends Pencil{     public void write (String content){  System.out.println("Rubber Write"+content);     }  public void erase (String content)}}  执行下列代码的结果是哪项?()      Pencil  pen=new  Pencil();  (( RubberPencil) pen).write( "Hello");    A、Write HelloB、Rubber Write HelloC、编译失败D、运行时抛出异常

10. class MakeFile {  11. public static void main(String[] args) {  12. try {  13. File directory = new File(”d”);  14. File file = new File(directory,”f”);  15. if(!file.exists()) {  16. file.createNewFile();  17. }  18. } catch (IOException e) {  19. e.printStackTrace  20. }  21. }  22. }  The current directory does NOT contain a directory named “d.” Which three are true?()A、 Line 16 is never executed.B、 An exception is thrown at runtime.C、 Line 13 creates a File object named “d”.D、 Line 14 creates a File object named “f‟.E、 Line 13 creates a directory named “d” in the file system.F、 Line 16 creates a directory named “d” and a file “f”  within it in the file system.G、 Line 14 creates a file named "f " inside of the directory named “d” in the file system.

You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()A、Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return "New York"; } } B、Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = "New York"; C、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; } D、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes["CityName"]; }

根据α=0.05,n=20查《符号检验界域表》得临界界域为(5,15),因此要想拒绝Η0,则()A、S-=7,S+=13B、S-=8,S+=12C、S-=4,S+=16D、S-=9,S+=11

单选题根据α=0.05,n=20查《符号检验界域表》得临界界域为(5,15),因此要想拒绝Η0,则()AS-=7,S+=13BS-=8,S+=12CS-=4,S+=16DS-=9,S+=11

单选题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();   }AImplementation a.BImplementation b.CImplementation c.DImplementation d.EImplementation e.

单选题现有:      class Pencil  {  public void write (String content){     System.out.println( "Write",+content){     }     }class RubberPencil extends Pencil{     public void write (String content){  System.out.println("Rubber Write"+content);     }  public void erase (String content)}}  执行下列代码的结果是哪项?()      Pencil  pen=new  Pencil();  (( RubberPencil) pen).write( "Hello");AWrite HelloBRubber Write HelloC编译失败D运行时抛出异常

单选题现有:  String s="write a line to a file";     w.print(s+"/n");      哪一个是对的?()Aw即可以是PrintWriter类型,也可以足BufferedWriter类型。Bw即不可以是PrintWriter类型,也不可以足BufferedWriter类型。Cw可以是BufferedWriter类型,但不可以是PrintWriter类型。D w以是PrintWriter类型,但不可以是BufferedWriter类型。

单选题现有:      class Pencil  {  public void write (String content){  System.out.println ("Write"+content);     }     }  class RubberPencil extends Pencil{     public void write (String content){  System.out.println ("Rubber Write"+content);     }  public void erase (String content){     System.out.println ("Erase "+content);     }     } 执行下列代码的结果是哪项?()  Pencil pen=new RubberPencil();      pen.write("Hello");A  Write HelloB  Rubber Write HelloC编译错误D运行时抛出异常

单选题Given: Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?()A String regex="";B String regex=" .";C String regex=".*";D String regex="//s";E String regex="//.//s*";F String regex="//w[/.]+";