参考答案和解析
正确答案: A
解析: 暂无解析
更多“单选题Strings="This is the";Stringt=s.concat("String.");t的内容是()A This is the StringB This is theC String”相关问题
  • 第1题:

    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;


    参考答案:A, C, D
    这个在前面第10题的equals()方法和==操作符的讨论中论述过。==操作符比较的是操作符两端的操作数是否是同一个对象,而String的equals()方法比较的是两个String对象的内容是否一样,其参数是一个String对象时才有可能返回true,其它对象都返回假。需要指出的是由于s和t并非使用new创建的,他们指向内存池中的同一个字符串常量,因此其地址实际上是相同的(这个可以从反编译一个简单的测试程序的结果得到,限于篇幅不列出测试代码和反编译的分析),因此答案c也是正确的。

  • 第2题:

    A method returning length of the String.


    正确答案:
     

  • 第3题:

    下列的( )程序段可能导致错误。

    A.String s="hello": Sting t="good"; String k=s+t;

    B.Sting s="hello"; String t; t=s [3] + "one";

    C.Sting s="hello"; String standard=s.toUpperCase( );

    D.String s="hello": Stringt s +"good";


    正确答案:B

  • 第4题:

    var x="this"+"is a string.";x的值为this is a string。()


    正确答案:正确

  • 第5题:

    Strings="This is the";Stringt=s.concat("String.");t的内容是()

    • A、This is the String
    • B、This is the
    • C、String

    正确答案:A

  • 第6题:

    public static void main方法的参数描述正确的有()。

    • A、String args[]
    • B、String[] args
    • C、Strings args[]z
    • D、String args
    • E、Strings arg[]

    正确答案:A,B

  • 第7题:

    下面字符串中非法字符串为().

    • A、’a string’
    • B、"a string"
    • C、’It is a’string’’
    • D、"It is a’string.’"

    正确答案:C

  • 第8题:

    1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()

    • A、 String s = strings.get(0);
    • B、 Iterator i1 = strings.iterator();
    • C、 String[] array1 = strings.toArray();
    • D、 Iterator i2 = strings.iterator();
    • E、 String[] array2 = strings.toArray(new String[1]);
    • F、 Iterator i3 = strings.iterator();

    正确答案:A,B,D,E

  • 第9题:

    判断题
    var x="this"+"is a string.";x的值为this is a string。()
    A

    B


    正确答案:
    解析: 暂无解析

  • 第10题:

    单选题
    下面是VB中有效的注释语句是()
    A

    //Dim a As String

    B

    /Dim a As String

    C

    ‘Dim a As String

    D

    “Dim a As String


    正确答案: D
    解析: 暂无解析

  • 第11题:

    单选题
    Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()
    A

     Line 5 will not compile, because void methods cannot be overridden.

    B

     Line 12 will not compile, because there is no version of test() that rakes a charargument.

    C

     The code will compile but will throw an exception at line 12.

    D

     The code will compile and produce the following output: I am an int.

    E

     The code will compile and produce the following output: I am a String.


    正确答案: D
    解析: 在第12行,16位长的char型变量ch在编译时会自动转化为一个32位长的int型,并在运行时传给void test(int i)方法。

  • 第12题:

    单选题
    floatf;Strings;现需要把float转化为String,正确的语句是()
    A

    s=String.valueOf(f);

    B

    f=Float.parseFloat(s);

    C

    s=f;

    D

    s=(String)f;


    正确答案: A
    解析: 暂无解析

  • 第13题:

    请读程序: 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.STRING

    B.STRING

    C.STRING

    D.不确定的值


    正确答案:D

  • 第14题:

    给定如下所示的JAVA代码,则运行时,会产生( )类型的异常Strings=null;s.concat("abc&quo

    给定如下所示的JAVA代码,则运行时,会产生( )类型的异常

    Strings=null;

    s.concat("abc");

    A.ArithmeticException

    B.NullPointerException

    C.IOException

    D.ClassNotFoundException


    正确答案:B

  • 第15题:

    A tow of 9 barges is made up three abreast by three long. The towboat is faced up to the last barge of the center string. The outer two strings of barges are the ______.

    A.port and starboard strings

    B.outer strings

    C.drag strings

    D.side strings


    正确答案:C

  • 第16题:

    public static void main方法的参数描述是()。

    • A、String args[]
    • B、String[] args
    • C、Strings args[]z
    • D、String args

    正确答案:A,B

  • 第17题:

    public static void main方法的参数描述是()

    • A、String args[]
    • B、int[] args
    • C、Strings args[]
    • D、String args

    正确答案:A

  • 第18题:

    设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。


    正确答案:错误

  • 第19题:

    已知如下定义:Strings="story";下面哪个表达式是合法的()

    • A、s+="books"
    • B、charc=s[1]
    • C、intlen=s.length
    • D、Stringt=s.toLowerCase()

    正确答案:A,D

  • 第20题:

    单选题
    下面字符串中非法字符串为().
    A

    ’a string’

    B

    a string

    C

    ’It is a’string’’

    D

    It is a’string.’


    正确答案: C
    解析: 暂无解析

  • 第21题:

    判断题
    设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。
    A

    B


    正确答案:
    解析: 暂无解析

  • 第22题:

    单选题
    import java.util.*;  public class LetterASort {  public static void main(String[] args) {  ArrayList strings = new ArrayList();  strings.add(‟aAaA”);  strings.add(”AaA”); strings.add(‟aAa”);  strings.add(”AAaa”);  Collections.sort(strings);  for (String s: strings) { System.out.print(s + “ “); }  }  }  What is the result?()
    A

     Compilation fails.

    B

     aAaA aAa AAaa AaA

    C

     AAaa AaA aAa aAaA

    D

     AaA AAaa aAaA aAa

    E

     aAa AaA aAaA AAaa

    F

     An exception is thrown at runtime.


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    A tow of 9 barges is made up three abreast by three long. The towboat is faced up to the last barge of the center string. The outer two strings of barges are the().
    A

    port and starboard strings

    B

    outer strings

    C

    drag strings

    D

    side strings


    正确答案: A
    解析: 暂无解析