Assuming that string1 = “hello” and string2 = “hello world”, Which of the following returns 0?
举一反三
- 下列语句正确的是( ) A: char string[]; string="china"; B: char string1[],string2[]; string2={"china"}; strcpy(string1,string2); C: char string1[5],string2[]={"china"}; string1=string2; D: char string[]="china";
- 以下要输出“hello,world!”正确的是? A: String s=String.format("%1s%2s","hello","world");System.out.println(s); B: String s=String.format("%1$s,%2$s","hello","world");System.out.println(s); C: String s=String.format("%s,%s","hello","world");System.out.println(s); D: String s=String.format("%1s,%2s","hello","world");System.out.println(s);
- 下面的哪些程序片断可能导致错误?( ) A: String s=”Hello”; String t=,,World"; String k=s+t; B: String s=,,Hello";String t;t=s[3]+"one"; C: String s="Hello,,;String standard = s.tollpperCase(); D: String s="Hello World”;String t=s-”World”;
- 下列定义字符串类string对象的语句中,错误的是( )。 A: string str; B: string str( “Hello, world” ); C: string str = “Hello, world”; D: string str = ‘Hello, world’;
- String s1="Hello";String s2="World";System.out.println(s2+s1);运行的结果是? A: HelloWorld B: Hello World C: WorldHello D: World Hello