网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

String str; System.out.println(str.length()); 以上语句运行的结果是显示0 。


参考答案

更多 “String str; System.out.println(str.length()); 以上语句运行的结果是显示0 。” 相关考题
考题 若输入bcdefgh、m、abcdefg,以下程序的输出结果为()。includeincludemain(){i 若输入bcdefgh、m、abcdefg,以下程序的输出结果为( )。 #include<stdio.h> #include<string.h> main() { int i; char string[20],str[3][20]; for(i=0;i<3;i++)gets(str[i]); if(strcmp(str[0],str[1])>0) strcpy(string,str[0]); else strcpy(string,str[1]); if(strcmp(str[2],string)>0) strcpy(string,str[2]); printf("%s",string); }A.bcdefghB.mC.abcdefgD.bcdefgh或abcdefg

考题 下列哪个语句是声明一个含有10个String对象的数组( )?A.char str[];B.char str[][];C.String str[]=new String[10];D.String str[10];

考题 已知String str=new String ("Luck");,则下列关于str的操作中不合法的是( )。A.String s=str. toUpperCase()B.int i=Str. length;C.char s=str. charAt(2);D.String s="Good" +str;

考题 publicstaticvoidmain(String[]args){Stringstr=null?;if(str==null){System.out.println(”null”);}else(str.length()==0){System.out.println(”zero”);}else{System.out.println(”some”);}}Whatistheresult?() A.nullB.zeroC.someD.Compilationfails.E.Anexceptionisthrownatruntime.

考题 publicclassTest{publicstaticvoidmain(String[]args){Stringstr=NULL;System.out.println(str);}}Whatistheresult?() A.NULLB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.

考题 先阅读下面的程序片段:String str="abccdefcdh";String[] arr=str.split"c";System.out.println(arr.length);程序执行后,打印的结果是( )。 A、2个B、3个C、4个D、5个

考题 下面代码的运行结果是( )。 public class ConcatTest { public static void main (String[ ] args) { String str1 = "abc"; String str2 = "ABC"; String str3 = str1. coneat(str2); System. out. println(str3); } }A.abcB.ABCC.abcABCD.ABCabc

考题 阅读下面程序 public class ConcatTest { public static void main(String[] args) { String str1="abc"; String str2="ABC": String str3=str1.concat(str2); System.out.println(str3); } } 程序运行的结果是A.abcB.ABCC.abcABCD.ABCabc

考题 下列( )语句是声明一个含有10个String对象的数组。A.char str [];B.char str [] [];C.String str[]=new String[10];D.String str[10];

考题 阅读下面程序 public class ConcatTest{ public static void main(String[] args) { String strl = "abc"; String str2 = "ABC"; String str3 = str1.concat(str2); System.out.println(str3); } } 程序的运行结果是:A.abeB.ABCC.abcABCD.ABCabc

考题 下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run() System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start ( ); } }A.new MyRun(my)B.new Thread()C.new Thread(my)D.Thread(my)

考题 本题分别比较两个字符串"A"和"a"是否相等,并比较两个字符"A"和"a"是否相等,并输出比较结果。public class javal{public static void main(String[]args){;cl=‘A ‘;c2=‘a‘;String strl=new String("A"),str2=new String("a"):if( )System.Out.println("char"+c1+"equals"+"char"+c2);elseSystem.OUt.println("char"+cl+"doesn‘t equal"+"char"+c2);if( )System.out.println("string"+strl+"equals"+"string"+str2):elseSystem.OUt.println("string"+strl+"doesn‘t e-qual"+"string"+str2); .}}

考题 public static void parse(String str) {  try {  float f= Float.parseFloat(str);  } catch (NumberFormatException nfe) {  f= 0;  } finally {  System.out.println(f);  }  }  public static void main(String[] args) {  parse(”invalid”);  }  What is the result?() A、 0.0B、 Compilation fails.C、 A ParseException is thrown by the parse method at runtime.D、 A NumberFormatException is thrown by the parse method at runtime.

考题 public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A、 nullB、 zeroC、 someD、 Compilation fails.E、 An exception is thrown at runtime.

考题 public class Test {  public static void main(String[] args) {  String str = NULL;  System.out.println(str);  }  }   What is the result?()  A、 NULLB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.

考题 下列哪个语句是声明了一个含有10个string对象的数组()。A、char str[];B、char str[][];C、string str[]=newstring[10];D、string str[10];

考题 Given the following code fragment:      1) String str = null;  2) if ((str != null)  (str.length()  10)) {     3) System.out.println("more than 10");     4) }  5) else if ((str != null)  (str.length()  5)) {     6) System.out.println("less than 5");     7) }  8) else { System.out.println("end"); }   Which line will cause error?()    A、 line 1B、 line 2C、 line 5D、 line 8

考题 Which expressions are correct to declare an array of 10 String objects? ()   A、 char str[];B、 char str[][];C、 String str[];D、 String str[10];

考题 public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A、nullB、zeroC、someD、Compilationfails.E、Anexceptionisthrownatruntime.

考题 单选题Which expressions are correct to declare an array of 10 String objects? ()A  char str[];B  char str[][];C  String str[];D  String str[10];

考题 单选题11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?()A  Au exception is thrown at runtime.B  “String is empty” is printed to output.C  Compilation fails because of au error in line 12.D  “String is not empty” is printed to output.

考题 单选题Given the following code fragment:      1) String str = null;  2) if ((str != null)  (str.length()  10)) {     3) System.out.println("more than 10");     4) }  5) else if ((str != null)  (str.length()  5)) {     6) System.out.println("less than 5");     7) }  8) else { System.out.println("end"); }   Which line will cause error?()A  line 1B  line 2C  line 5D  line 8

考题 单选题public class Test {  public static void main(String[] args) {  String str = NULL;  System.out.println(str);  }  }   What is the result?()A  NULLB  Compilation fails.C  The code runs with no output.D  An exception is thrown at runtime.

考题 判断题String str; System.out.println(str.length()); 以上语句运行的结果是显示0 。A 对B 错

考题 单选题public static void parse(String str) {  try {  float f= Float.parseFloat(str);  } catch (NumberFormatException nfe) {  f= 0;  } finally {  System.out.println(f);  }  }  public static void main(String[] args) {  parse(”invalid”);  }  What is the result?()A  0.0B  Compilation fails.C  A ParseException is thrown by the parse method at runtime.D  A NumberFormatException is thrown by the parse method at runtime.

考题 单选题public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A  nullB  zeroC  someD  Compilation fails.E  An exception is thrown at runtime.

考题 单选题public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A nullB zeroC someD Compilationfails.E Anexceptionisthrownatruntime.