下面这段代码会产生( )个String对象。Strings1="hello";Strings2=s1.substring(2,3);Strings3=s1.toString();Strings4=newStringBuffer(s1).toString();A、1B、2C、3D、4

下面这段代码会产生( )个String对象。

Strings1="hello";

Strings2=s1.substring(2,3);

Strings3=s1.toString();

Strings4=newStringBuffer(s1).toString();

A、1

B、2

C、3

D、4


相关考题:

如果String s1=“Chongqing”,则运行代码String s3=s1.substring(2,4)后s3的值为() A、honB、hoC、onD、ngq

假设有以下代码: String s="hello"; String t="hello"; char c[ ]={'h','e','l','l','o'}; 下列选项中,返回false的语句是______。A.s.equals(t);B.t.equals(c);C.s==t;D.t.equals(new String("hello"));

给出下面的代码,则以下( )选项返回true。 String s="hello"; String t="hello"; Char c[]={'h','e','l','l','o'};A.s. equals (t) ;B.t. equals (C);C.s==t;D.t==c;

有如下applet代码:import java.applet.*;import java.awt.*;public class MyApplet extends Applet{AA s;public void int(){s = new AA("Hello!", "I love JAVA.");}public void paint(Graphics g){g.drawString(s.toString(), 30, 50);}}class AA{String s1;String s2;AA(String str1, String str2){s1 = str1;s2 - str2;}public String toString(){return s1 + s2;}}运行后,窗口上将会出现什么,选择一个正确答案______。A.Hello!B.I love JAVA.C.Hello! I love JAVA.D.什么都没有

下列代码的执行结果是()。publicclasstest5{publicstaticvoidmain(Stringargs[]){Strings1=newString("hello");Strings2=newString("hello");System.out.prim(s1==s2);System.out.print(",");System.out.println(s1.equals(s2));}A.true,falseB.true,trueC.false,trueD.false,false

下列的哪个程序段可能导致错误? ( )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"

给出下列的代码,则以下哪个选项返回true? String s="hello"; String t="hello"; char c []= {'h','e','1','1','o'};A)s.equals(t);A.t. equals(B.;C.s==t;D.t==c;

下列语句输出结果为( )。 public class test { public static void main (String args[]) { Strings1=newString("HOW"); Strings2=newString("How"); System.out.println(!(s1.equals(s2))): } }A.假B.真C.0D.1

String s = "Hello";s = s + " world!";这两行代码执行后,原始的String 对象中的内容到底变了没有?

阅读下面程序 publicclass Operators AndExpressions{ voidequalsMethodl(){ Strings1=newString("howareyou"); Strings2=newString("howareyou"); System.out.println(s1==s2); } publicstaticvoidmain(Stringargs[]){ OperatorsAndExpressionsOperAndExp=newOperatorsAndExpressions (); //用于复合类型数据的“==”运算符 OperAndExp.equalsMethodl(); } } 程序运行结果是( )。A.==B.trueC.falseD.equal

下列代码段的执行结果是( )。 public class Test { public static void main(String args[ ]) { String s1= new String("hello"); String s2= new String("hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }A.true falseB.true trueC.false trueD.false false

下列代码的执行结果是______。 public class ex55 { public static void main(String args[] ) { String s1=new String("hello"); String s2=new String("hello"); System.out.print (s1==s2); System.out.print (","); System.out.println (s1.equals (s2)); } }A.true, falseB.true, trueC.false, trueD.false, false

下面的程序执行后,屏幕上显示的应是( )。 publicclassExam{ publicstaticvoidmain(String[]args){ charcharl[]={'t','e','s','t'}; charchar2[]={'t','e,'s','t','1'}; Strings1=newString(char1); Strings2=newString(char2,0,4); System.out.println(s1.equals(S2)); } }A.trueB.falseC.testD.编译错误

下列程序的执行结果是 public class Testhh { public static void main(String args [] ) { Strings1=new String("I am boy"); Strings2=new String("I am boy"); System.out.println(s1.equals(s2)); } }A.真B.假C.I am boyD.都不正确

给出下列的代码则以下哪个选项返回true? String s = "hello" ; String s = "hello" ; char c[] = { 'h' ,'e','l','o'};A.s.equals(t);B.t.equals(c);C.s = =tD.t = = c;

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

下面的代码实现一个简单的Applet: import java.applet.Applet; import java.awt.*; public class Sample extends Applet { private String text="Hello World"; public void init() { add(new Label(text)); } public Sample(String string) { text=string; } } 通过下面的HTML文件访问: <html> <title>Sample Applet</title> <body> <applet code="Sample.class"width=200 height=200></applet> </body> </html> 当编译和运行该小程序时会出现什么结果,请选择正确的答案。( )A.将会出现“Hello World"B.将会产生一个运行时错误C.什么都没有D.产生一个编译时错误

执行以下代码会输出什么结果?()   public class Test {    StringgetStr(String s){  return s + “hello”;  }  public static void main(String arg[]) {           Test t= new Test();  System.out.println(t.getStr(“LiLei/n”));     } } A、 编译报错B、 LiLei    helloC、 LiLeihelloD、 无任何输出

下面哪些代码中声明的变量可以存放10个String对象()A、String[]a;B、Object[]a;C、String[50]a;D、chara[][];

设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。

String s= "hello";     String t = "hello";  char c[] = {’h’,’e’,’l’,’l’,’o’} ;     Which return true?()   A、 s.equals(t);B、 t.equals(c);C、 s==t;D、 t.equals(new String("hello"));E、 t==c;

public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()    A、 The program runs and prints “Hello”B、 An error causes compilation to fail.C、 The program runs and prints “Hello world!”D、 The program runs but aborts with an exception.

判断题设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。A对B错

单选题给定如下所示的JAVA代码,则运行时,会产生()类型的异常。 String s=null; s.concat("abc");AArithmeticExceptionBNullPointerExceptionCIOExceptionDClassNotFoundException

单选题执行以下代码会输出什么结果?()   public class Test {    StringgetStr(String s){  return s + “hello”;  }  public static void main(String arg[]) {           Test t= new Test();  System.out.println(t.getStr(“LiLei/n”));     } }A 编译报错B LiLei    helloC LiLeihelloD 无任何输出

单选题public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()A The program runs and prints “Hello”B An error causes compilation to fail.C The program runs and prints “Hello world!”D The program runs but aborts with an exception.