publicclasstest(privatestaticintj=0;privatestaticbooleanmethodB(intk)(j+=k;returntrue;)publicstaticvoidmethodA(inti)(booleanb:b=i<10|methodB(4);b=i<10||methodB(8);)publicstaticvoidmain(Stringargs[])(methodA(0);system.out.printIn(j);))Whatistheresult?()A.T

题目

publicclasstest(privatestaticintj=0;privatestaticbooleanmethodB(intk)(j+=k;returntrue;)publicstaticvoidmethodA(inti)(booleanb:b=i<10|methodB(4);b=i<10||methodB(8);)publicstaticvoidmain(Stringargs[])(methodA(0);system.out.printIn(j);))Whatistheresult?()

A.Theprogramprints“0”

B.Theprogramprints“4”

C.Theprogramprints“8”

D.Theprogramprints“12”

E.Thecodedoesnotcomplete.


相似考题
更多“publicclasstest(privatestaticintj=0;privatestaticbooleanmethodB(intk)(j+=k;returntrue;)pub ”相关问题
  • 第1题:

    下面会导致死循环的是()

    A.A for(int k=0;k<0;k++)

    B.B for(int k=10;k>0;k--)

    C.C for(int k=0;k<10;k--)

    D.D for(int k=0;k>0;k++)


    C for(int k=0;k<10;k--)

  • 第2题:

    下面哪一个循环会导致死循环?()

    A.for (int k = 0; k < 0; k++)

    B.for (int k = 10; k > 0; k--)

    C.for (int k = 0; k < 10; k--)

    D.for (int k = 0; k > 0; k++)


    C

  • 第3题:

    下面哪一个循环会导致死循环?()

    A.for (int k = 0; k < 0; k++)

    B.for (int k = 10; k > 0; k--)

    C.for (int k = 0; k < 10; k++)

    D.for (int k = 0; k >= 0; k++)


    for (int k = 0; k > 0; k++)

  • 第4题:

    下面那一个循环会导致死循环?()

    A.for (int k = 0; k < 0; k++)

    B.for (int k = 10; k > 0; k--)

    C.for (int k = 0; k < 10; k--)

    D.for (int k = 0; k > 0; k++)


    A 解析:for循环的一般格式为for(初始化部分;终止条件判断部分;迭代部分){循环体;}说明如下:for循环开始时,首先执行初始化操作,然后判断终止条件是否满足,如果满足,则执行循环体中的语句,最后执行迭代部分。完成一次循环后,重新判断终止条件。注意:在for语句中,如果省略了终止条件判断部分,并且在语句中没有break,或者是终止条件判断部分始终没有终止,都将出现死循环。注意:for循环语句可由while循环语句来代替。

  • 第5题:

    【多选题】下面()会产生死循环 。

    A.for (int k = 0; k < 0; k++)

    B.for (int k = 10; k > 0; k--)

    C.for (int k = 0; k < 10; k--)

    D.for (int k = 0; k > 0; k++)


    错误