更多“int a =’A’,请问System.out.println(a)打印出什么?() ”相关问题
  • 第1题:

    有如下程序段 if(x>0) { System.out.println("first");} else if (x > -4) { System.out.println("second");} else { System.out.println("third");} x的取值在什么范围内时,将打印出字符串“second"?

    A.x > 0

    B.x > -4

    C.x < = -4

    D.x < = 0 & & x > -4


    正确答案:D
    解析:此题考查if语句的用法,x>0时打印“first”,x,-3&&x<=0时打印“second”,x<=-3时打印“third”。

  • 第2题:

    请问Int(3.45)和Int(-3.45)的返回值是什么?()

    A.4、-4

    B.3、-4

    C.3、3

    D.3、-3


    参考答案:B

  • 第3题:

    下面的程序会抛出什么异常类型? public class Test { public static void main(String[] args) { int[] list = new int[5]; System.out.println(list[5]); } }

    A.ArithmeticException

    B.ArrayIndexOutOfBoundsException

    C.StringIndexOutOfBoundsException

    D.ClassCastException


    E

  • 第4题:

    有如下程序段 if(x>0){System.out.println("first");} else if(x>-4){System.out.println("second");{ else{System.out.println("third");}x的取值在什么范围内时,将打印出字符串“second”? ( )

    A.x>0

    B.x>-4

    C.x<-4

    D.x<0&&x>-4


    正确答案:C

  • 第5题:

    给出以下代码,请问该程序的运行结果是()。 class Test{ public static void main(String[] args){ int[] a = {1,2,3,4,5}; System.out.println(a[5]); } }

    A.1

    B.3

    C.5

    D.异常


    [‘an’, ‘apple’, ‘a’, ‘day’]