假设s1、s2、s3、s4是四个字符串,给定如下语句: String s1 = "Welcome to Java"; String s2 = s1 String s3 = new String("Welcome to Java"); String s4 = "Welcome to Java";以下选项结果是“false”的是哪个?
A: str1==str2
B: str1.equals(str3)
C: str1==str3
D: str1==str4
A: str1==str2
B: str1.equals(str3)
C: str1==str3
D: str1==str4
举一反三
- C#中,新建一字符串变量str,并将字符串"Tom′sLivingRoom"保存到串中,则应该使用下列哪条语句() A: string str = "Tom\'s Living Room"; B: string str = "Tom's Living Room"; C: string str("Tom's Living Room"); D: string str("Tom"s Living Room");
- 程序运行后的输出结果是( ) main() { char *str[]={"AA","BB","CC"}; str[1]=str[2]; printf("%s,%s,%s\n",*str,str[1],*(str+2)); }
- 下面哪一项是不正确的字符串赋值或不正确的赋初值的方式?() A: char *str;str="string"; B: char str[7]={'s','t','r','i','n','g'}; C: char str1[10];str1="string"; D: char str1[]="string",str2[]="1234567";
- 以下代码共创建了几个对象?String s1=new String("hello");String s2=new String("hello");String s3=s1;String s4=s2; A: 2 B: 4 C: 1 D: 3
- 以下程序的输出结果是 String s1="1",s2="2"; String s=s1+s2; System.out.println(s);