Whichexpressionswillevaluatetotrueifprecededbythefollowingcode?()Stringa=hello;Stringb=newString(a);Stringc=a;char[]d={’h’,’e’,’l’,’l’,’o’}; A.(a==Hello)B.(a==b)C.(a==c)D.a.equals(b)E.a.equals(d)
Whichexpressionswillevaluatetotrueifprecededbythefollowingcode?()Stringa="hello";Stringb=newString(a);Stringc=a;char[]d={’h’,’e’,’l’,’l’,’o’};
A.(a=="Hello")
B.(a==b)
C.(a==c)
D.a.equals(b)
E.a.equals(d)
相关考题:
假设有以下代码: 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"));
Strings=hello;Stringt=hello;charc[]={’h’,’e’,’l’,’l’,’o’};Whichreturntrue?() A.s.equals(t);B.t.equals(c);C.s==t;D.t.equals(newString(hello));E.t==c;
定义一个表示10个值为null的字符串数组,下面选项正确的是( )。A.String []a;B.String a[];C.char a[l0][];D.String a[]=new String[10];
请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值
下面各语句行中,能正确进行字符串赋值操作的语句是:A.char *s;scanf("%s",s);B.char st[4][5]={"HELLO"};C.char s[5]={'H', 'E', 'L', 'L', 'O'};D.char * s;s="HELLO";
【单选题】8.7 若有以下程序代码,则程序运行结果正确的是() public class DemoMain { public static void main(String []s){ String a = new String("hello"); String b = new String("hello"); String c = "hello"; String d = a; System.out.print((a==d)+" "+(a==b)+" "+(a==c)); } }A.true false trueB.true false falseC.true true falseD.false true true
下列代码的输出结果是什么? public static void main(String[] args) { String a = "110"; String b = "110"; String c = new String("110"); String d = new String(a); System.out.println(a == b); System.out.println(a == c); System.out.println(c == d); }A.true false falseB.true true trueC.true true falseD.编译错误
下面这些代码的功能是创建一个string对象 s,并将其内容设置为字符串 alohaworld ,正确的有:A.string s{'alohaworld'};B.string s = string{"alohaworld"};C.char* p = "alohaworld"; string s(p);D.string s{'a','l','o','h','a','w','o','r','l','d'};E.string s('a','l','o','h','a','w','o','r','l','d');
下列初始化字符数组的语句,正确的是()。A.char[] str = {'h', 'e', 'l', 'l', 'o'};B.char[5] str = "hello";C.char[5] str = {"hi"};D.char[100] str = "";