• 2022-05-29
    59 给定以下代码,哪些语句的结果不为 true String s1 = “hello” ; String s2 = “hello” ; String s3 = new String(“hello”) ; char[] c = {‘h’,’e’,’l’,’l’,’o’}; String s4 = new String(c);
    A: s1.equals(s2)
    B: s3.equals(s4)
    C: s1==s2
    D: s3==s4
  • D

    内容

    • 0

      以下程序的输出结果是 String s1="1",s2="2"; String s=s1+s2; System.out.println(s);

    • 1

      以下要输出“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);

    • 2

      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;

    • 3

      下面的哪些程序片断可能导致错误?( ) 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”;

    • 4

      给出下列的代码,则以下哪个选项返回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;