• 2022-05-28
    以下程序代码执行后,哪个说法正确?int index = 1;boolean[] test =new Boolean[3];boolean foo=test [index];
    A: 无法编译
    B: foo的值是true
    C: foo的值是false
    D: foo的值是0
  • A

    内容

    • 0

      下面程序段的运行结果为() int index=1; int[] foo=new int[3]; int bar=foo[index]; int baz= bar+index;

    • 1

      读代码: public class Test { public static void main (String args[]) { class Foo { public int i = 3; } Object o = (Object) new Foo(); Foo foo = (Foo)o; System.out.println(foo.i); } } 结果是:

    • 2

      关于以下初始化序列的执行结果的说法正确的是( )。 int index=1; int[] foo=new int[3]; int bar=foo[index]; int baz=bar+index; A: baz的值为0 B: baz的值为1 C: 编译通过,但产生异常 D: 编译不能通过

    • 3

      int index = 1; int foo = new int ; int bar = foo [index]; int baz = bar + index; What is the result?() A: Baz has the value of 0 B: Baz has the value of 1 C: Baz has the value of 2 D: An exception is thrown. E: The code will not compile.

    • 4

      对于 boolean  b[]=new boolean[3]; 下列哪个叙述是正确的?