[单选题]

下列程序中的循环体将会被执行 ( ) public class ex26 { public static void main(String[]args) { int n=4; while(n<=8) { System.out.println(n); n++; } }

A.8次

B.2次

C.4次

D.5次

参考答案与解析:

相关试题

3下列程序中的循环体将会被执行()。 public class ex26{ pu

[单选题]3下列程序中的循环体将会被执行( )。 public class ex26 { public static void main(String[] args) { int n=4; while(n<=8) { System.ou.println(n); n++; } } }A.8次B.2次C.4次D.5次

  • 查看答案
  • 下列程序中的循环体将会被执行______。public class ex20{p

    [单选题]下列程序中的循环体将会被执行______。 public class ex20 { public static void main(String[] args) { int x=3; do{ System.out.println("Hello!"); }while(x>=0); } }A.2次B.1次C.3次D.4次

  • 查看答案
  • 下列程序中的循环体将会被执行( )。public class Test { pu

    [单选题]下列程序中的循环体将会被执行( )。 public class Test { public static void main ( String[ ] args) { int i=3; do { System. out. println ( "Java."); i--; } while ( i >= 0 ); } }A.1次B.2次C.3次D.4次

  • 查看答案
  • 2下列程序的执行结果是( )。public class ex68 { publi

    [单选题]2下列程序的执行结果是( )。 public class ex68 { public static void main(String[] args) { ex68 bj=new ex680; int s=0; for(int i=1; i<=4; i++){ s+=obj.method(i); } System.out.println(s); } public int method(int n) { if(n==1) return 1; else tatum n * method(n-1); }

  • 查看答案
  • 执行下列程序后,输出结果为()。public class Test {publi

    [单选题]执行下列程序后,输出结果为( )。 public class Test { public static void main (String[] args) { StringBuffer sb = new StringBuffer("北京 2008" ); System. out. println ("length =" + sb. length ( ) ); } }A.length = 8B.length = 10C.length = 6D.length = 20

  • 查看答案
  • 下列程序执行后,k的值是()public class Testhhh{publi

    [单选题]下列程序执行后,k的值是 ( ) public class Testhhh { publicstaticvoidmain(Stnngargs[]) { int i=6,j=8,k=10,m=7; if(i>j||m<k- -) k+ +; else k--; System.out.println(k);A.12B.11C.10D.9

  • 查看答案
  • 执行下列程序时,会产生什么异常 public class Test {publi

    [单选题]执行下列程序时,会产生什么异常 public class Test { public static void main(String args[ ])( int d=101; int b=220; long a=321; System.out.println((a-B) /(a-b-D) ); } }A.ArrayIndexOutOfBoundsExceptionB.NumberFormatExceptionC.ArithmetieExceptionD.EOFException

  • 查看答案
  • 下列程序的执行结果是()public class ex68{ public st

    [单选题]下列程序的执行结果是 ( ) public class ex68{ public static void main(String[]args){ ex68 obj=new ex68(); int s=0; for(int i=1;i<=4;i++){ s+=obj.method(i); } System.out.println(s); } public int method(int n){ if(n==1) return 1; else return n*method(n-1); } }A.3B

  • 查看答案
  • 下列循环的循环体将被执行( )。int x =10, y=30;doty £­=

    [单选题]下列循环的循环体将被执行( )。 int x =10, y=30; dot y -= x; x++; while (x++>y--);A.0次B.1次C.2次D.3次

  • 查看答案
  • 下列循环的循环体将被执行()。int x =10, y=30;doty £­=

    [单选题]下列循环的循环体将被执行( )。 int x =10, y=30; dot y -= x; x++; while (x++>y--);A.0次B.1次C.2次D.3次

  • 查看答案
  • 下列程序中的循环体将会被执行()public class ex26{ publi