niusouti.com
更多“A: Hello, Bob. How's everything? B: That's all right.() ”相关问题
  • 第1题:

    下列的哪个程序段可能导致错误?

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

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

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

    D.String s = "hello"; String t = s + "good";


    正确答案:B
    解析:选项A)String类型可以直接使用“+”运算符进行连接运算。选项B)String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误。选项C)toUpperCase()方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型)。选项D)同选项A)。

  • 第2题:

    写出以下程序的运行结果? public class Test{ public static void main(String argv[]){ String s = new String("hello"); myMethod(s); System.out.print("s=" + s); } public static void myMethod(String s){ s = s + "!"; } }

    A.s=hello!

    B.s=hello

    C.hello!

    D.hello


    2,2,3

  • 第3题:

    下列定义的字符串,错误的是

    A.s ='hello'

    B.s = '''hello'''

    C.s = "hello"

    D.s = ""hello""


    char str[9]={ 'X', 'i', 'n', 'J', 'i','a','n','g','!','\0'};

  • 第4题:

    1、写出以下程序的运行结果? public class Test{ public static void main(String argv[]){ String s = new String("hello"); myMethod(s); System.out.print("s=" + s); } public static void myMethod(String s){ s = s + "!"; } }

    A.s=hello!

    B.s=hello

    C.hello!

    D.hello


    编译错误

  • 第5题:

    若字符串 s = 'hello',则语句 s.ljust(8, '.') 和 s.rjust(8) 的输出结果为____________。

    A.'hello...' ' hello'

    B.'...hello' ' hello'

    C.'hello...' 'hello '

    D.'hello...' 'hello'


    “<

  • 第6题:

    下列程序执行后的输出结果是 。 void main() { printf(“'s1=%7s'”,"hello"); }

    A.s1=”hello”

    B.s1=7hello

    C.'s1= hello'

    D.’s1=”hello”’


    B 解析:在屏幕上输入数值331后回车,a的值为八进制的331,其二进制表示为11011001。右移4位后为1101。故执行语句b=a>>4;得b的二进制表示为1101。 现在由语句c=~(~0<<4):计算c的值: 0: 0000000000000000 ~0: 1111111111111111 ~0<<4: 1111111111110000 ~(~0<<4): 0000000000001111 故c的值为1111。 由d=b&c;得到d为1101,即八进制的15。故本题答案为B。