题目内容

When you are writing a program with String objects that may have unwanted spaces at the beginning or end of the strings, use this method to delete them.(当你使用字符串对象编程时,字符串的开头或结尾可能有不需要的空格,使用什么方法删除它们?)

A. replace (替换)
B. trim (修剪)
C. valueOf (返回对象的值)
D. substring (子串)

查看答案
更多问题

现有:public class Tester {public static void main(String[] args) {int x = 5;Integer x1 = x;Integer x2 = x;int x3 = new Integer(5);System.out.print(x1.equals(x));System.out.print(x1 == x);System.out.print(x2.equals(x1));System.out.print(x2 == x1);System.out.print(x2 == x3);System.out.print(x2.equals(x3));}}结果为:

A. 编译失败
B. falsefalsetruetruetruetrue
C. truetruetruetruetruetrue
D. falsefalsetruetruetruefalse
E. truefalsetruefalsefalsetrue
F. 运行时异常被抛出

String foo="blue";boolean[] bar=new boolean[1];if(bar[0]){foo="green";}foo的值是多少? ( )

A. ""
B. null
C. blue
D. green

int index=1;String[] test=new String[3];String foo=test[index];foo的值是多少? ( )

A. ""
B. null
C. throw Exception
D. not compile

若变量s是String类型的数据,那么表达式(s+s)的类型是()

A. char
B. string
C. int
D. long

答案查题题库