给定一个java程序的代码片断如下,运行后正确的输出结果是( )。String s=”hello, world”;String str = s.replace(“,” , ” ”);System.out.println(str);
A: hello world;
B: hello, world
C: HELLO WORLD
D: HELLO ,WORLD;
A: hello world;
B: hello, world
C: HELLO WORLD
D: HELLO ,WORLD;
举一反三
- 以下语句执行结果是()String str = " hello World ";System.out.println(str.trim()); A: hello World B: hello World C: helloWorld D: 程序异常
- 以下要输出“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);
- 下列代码片段执行结果是:String s=new String(”abc”); String s1=new String(s); if(s==s1){ System.out.println(”Hello”); } if(s.equals(s1)){ System.out.println(”World”); } A: Hello World B: Hello C: World D: Null
- 11字符串测试1:下列字符串定义正确的是: A: String str="Hello World!"; B: Str str="Hello World!"; C: var str="Hello World!"; D: var str='Hello World!';
- 已知$str = " Hello World! ";下列说法正确的是: A: trim($str)结果是" Hello World!"; B: ltrim($str)结果是"Hello World! "; C: trim($str)结果是" Hello World!"; D: trim($str)结果是"Hello World!";