【单选题】下面程序段的输出结果是() 。 public class A{ public static void main(String args[]) { String str ="Hello,"; str=str+"Guys!"; System.out.println(str); } }A.hello,guys!B.hello,C.guys!D.编译不通过

【单选题】下面程序段的输出结果是() 。 public class A{ public static void main(String args[]) { String str ="Hello,"; str=str+"Guys!"; System.out.println(str); } }

A.hello,guys!

B.hello,

C.guys!

D.编译不通过


参考答案和解析
B

相关考题:

下面是一段javabean程序,该程序的运行结果是(62)。 public class NullTest { public static void main(String[] args) { int M = 0; String str = null; StringBuffer sb = new StringBuffer("= "); sb.append(str); sb.append(M++); System.out.println(sb.toString()); } }A.=nullB.=null0C.=null1D.=nullM

下列程序的运行结果是【 】。public class Test {public static void main (String args[]) {String s1="hello!";System.out.println (s1.toUpperCase());}}

下列程序的作用是在屏幕上显示一个200×200大小的窗口,在横线上填入相应的语句。import java.awt.*;public class Test extends Frame. {public static void main (String args[]) {Test t=new Test ("Hello");t.setSize (200,200);t.setBackground (Color.re@D)@;【 】;}public Test (String str) {super(str);}}

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

下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { for ( int a=0;a<10;a++) { if (a==5) break; System.out.println(A); } } }A.01234B.6789C.012346789D.5

指出下列程序运行的结果public class Example{ String str=newString("good"); char[]ch={'a','b','c'}; public static voidmain(String args[]){ Example ex=new Example();ex.change(ex.str,ex.ch); System.out.print(ex.str+" and ");Sytem.out.print(ex.ch); } public void change(String str,charch[]){ str="test ok"; ch[0]='g'; } } ( )AA good and abcBgood and gbcCtest ok and abcDtest ok and gbc

下面程序执行后,输出结果为:true请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class TestStringCompare{{public static void main(String ____________________ args){char charl[]={'t','e','s','t'};char char2[]={'t','e','s','t','1'};String str1=new String(___________________);String str2=new String(char2,0,4);System.out.println(__________________________);}}

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.

有下列程序段 public class fun { public static void main(String args[]) { char b[]="Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是( )。A.Hello, youB.Hello0youC.HelloD.0

下面代码的运行结果是( )。 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

阅读下面程序 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

指出下列程序运行的结果 ( ) public class Example{ String str=new String("good"); char[]ch={'a','b','c'}; public static void main(String args[]){ Example ex=new Example(); ex.change(ex.otr,ex.ch); System.out.print(ex.str+"and"); System.out.print(ex.ch); } public void change(String str,char ch[])} str="test ok"; ch[0]≈'g'; } }A.good and abcB.good and gbcC.test ok and abcD.test ok and gbc

下列程序段的输出是( )。 public class Test { public static void main (String args[ ]) { String ss1 = new String("hello"); String ss2 = new String("hello"); System.out.println(ssl == ss2); System.out.println (ssequals(ss2)); } }A.true, falseB.true, trueC.false, trueD.false, false

下列程序的输出结果是( )。 public class Test { public static void main (String[] args) { String s="hello"; s.replace ('r','m'); System.out.println(s); } }A.helloB.HELLOC.hemmoD.HEMMO

下列程序通过实现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)

下面程序段的输出结果为 public class MyClass { public static void main(String args[]) { String s="Hello! How are you?"; System.out.println(s.LastIndexOf("o",16); } }A.16B.oC.uD.17

下列程序运行的结果为:public class Example{String str=new String("good");char[] ch={'a','b','c'};public static void main(String args[]){Example ex=new Example();ex.change(ex.str,ex.ch);System.out.print(ex.str+" and ");Sytem.out.print(ex.ch);}public void change(String str,char ch[]){str="test ok";ch[0]='g';}}A. good and abcB. good and gbcC. test ok and abcD. test ok and gbc

public class TestString 1 {  public static void main(String[] args) {  String str = “420”;  str += 42;  System.out.print(str);  }  }  What is the output?()A、 42B、 420C、 462D、 42042E、 Compilation fails.F、 An exception is thrown at runtime.

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.

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.

单选题public class TestString 1 {  public static void main(String[] args) {  String str = “420”;  str += 42;  System.out.print(str);  }  }  What is the output?()A 42B 420C 462D 42042E Compilation fails.F 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.

单选题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?()AnullBzeroCsomeDCompilationfails.EAnexceptionisthrownatruntime.