首页/ 题库 / [单选题]下列程序中的循环体将会被执行______的答案

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

单选题
2022-02-28 13:42
A、8次
B、4次
C、2次
D、5次
查看答案

正确答案
D

试题解析

标签:
感兴趣题目
编译和运行下列程序,请选择正确的输出结果______。 public class ex31 { private void test() { System.out.println(6 + 6 + "(Result)"); } public static void main(String[] args) { new ex31().test(); } }
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是
阅读下面Applet程序 import javax.swing.*: import java.awt.*: public Class Test SwingApplet extends JApplet { JLabel 1=new JLabel("This is a Swing Applet."); public void init() { ______ } } 程序中下画线处应填入的正确选项是
阅读下面Applet程序 import javax. swing. *; import java. awt. *; public class SwintgApplet extends JApplet{ JLabel 1=new JLabel("This is a Swing Applet."); public void init(){ ________________________________ } } 在程序下画线处填入正确的选项是
下面程序的执行结果是______。 public class ex27 { public static void main(String[] args) { try { return; } finally { System. out. print in ( "Finally" ); } }
在下列程序的划线处应填入的语句是 ( ) class Person { private int a; } public class Man extends Person { public int b public static void main(String arg[]) { Person P=new Person(); Man t=new Man(); int i; ______ } }
执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }
下列程序段中,正确的是______。 ①class MvClass { int var = 100; static int getVar() { return var; } } ②public class MyClass { final int date; void MyClass (int d) { date = d; } } ③public class MyMain { public static void main(String args[]) { System.out.println(Myclass1.date); } } class MyClass1 { int data = 10; } ④class IamAbstract { final int f; double d; abstrct void method(); }
下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file " ;} }; void main() { A a,*p; B b; C c; D d; p=&c; p->fun (); p=&b; p->fun (); p=&d; p->fun(); }
在下列横线处应添加的语句是( )。 class Base{public:void fun(){cout<<"Base::fun"<<end1;}}; class: Derived: public Base { public: void fun() { ______//显示调用基类的fun函数 cout<<"Derived::fun"<<end1; } };
在下列程序的划线处应填入的语句是 class Pemon { pnvate int a; } public class Man extends Person { public int b; public static void main(String arg[ ] ) { Person p = new Person( ); Man t = new Man( ); int i; ________ } }
相关题目
下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file " ;} }; void main() { A a,*p; B b; C c; D d; p=&c; p->fun (); p=&b; p->fun (); p=&d; p->fun(); }
应在下面程序下划线中填写的正确的语句是( )。 #include <iostream> using namespace std; class A{ public: void test(){cout<< "this is A!";} }; class B:public A{ void test(){ ______ //显示调用基类函数test() cout<< "this is B!"; } }; void main(){}
在下列横线处应添加的语句是( )。 class Base{public:void fun(){cout<<"Base::fun"<<end1;}}; class: Derived: public Base { public: void fun() { ______//显示调用基类的fun函数 cout<<"Derived::fun"<<end1; } };
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是
对于类定义 class A { public: virtual void funcl(){} void func2(){} }; class D:public A{ public: void funcl(){cout<< "class B rune 1"<<end1;} virtual void func2(){cout<< "class B func 2"<<end1;} }; 下面正确的叙述是 ______。
下列语句序列执行后,K的值是______。 public class Test11 { public static void main(String[] args) { int m=3, n=6, k=0; while ((m++)<(n--)) ++k; System.out.println (k); } }
给出下列的程序代码片段,下列的______选项是不正确的。 ( )①public void create(){②Vector my;③my=new Vector();④}
阅读下面代码 public class Jixiangwu { public static void main(String[] args) { String[] stars={"贝贝","晶晶","欢欢","迎迎","妮妮"}; System.out.println("你抽取的奥运吉祥物是"+ "“"+stars[(int)(stars. ______ *Math.random())]+"”"+"!"); } } 为保证程序能正确执行,程序中下画线处应填写的是
执行如下语句之后,输出的结果是______。 public class ex36 { public static void main(String[] args) { int x=-6, y=6; x=x+y--; System.out.println (x); } }
执行如下语句之后,输出的结果是______。 public class ex24 { public static void main(String[] args) { int x=5,y=3; x+=X-- *--y; System.out.println{x); } }
执行下列程序段之后,变量b的值为______。 public class Test9 { public static void main(String[] args) { int i=12; int j=24; boolean b1=true; boolean b=(j%i== 0)&&(!b1) ||(j/i!=2); System.out.println(b); } }
执行下列代码之后,输出的结果为______。 public class ex27 { public static void main(String[] args) { iht x=7; int y=15; boolean bb=(127|x)>7&&(-128∧y)<15; System.out. println(bb); } }
下列程序段执行后,x5的结果是______。 public class ex42 { public static void main(String[] args) { int xl = 8; int x2 = 12; int x3=7; int x4; int x5; x4 = x1 > x2 ? x1 : x2+ x1; x5 = x4 > x3 ? x4 : x3; System.out.println(x5); } }
下列程序的执行结果是______。 class A1 implements Runnable { public void run() { for(iht i = 0; i < 10; i++) { System.out.println("i =" + i); if(i == 3) break; } } } public class ex38 { public static void main(String[] args) { Thread th1 = new Thread(new A1()); th1.start (); } }
能将程序补充完整的选项是 class Person { private int a; public int change(int m){return m; } } public class Teacher extends Person { public int b; public static void main(String arg[]) { Person p=new Person(); Teacher t=new Teacher(); int i; ______ } }
能将程序补充完整的选项是 class Person { private int a; public int change(int m){return m;} } public class Teacher extends Person { public int b; public static void main(String arg[]) { Person p=new Person(); Teacher t=new Teacher(); int i; _____ } }
能将程序补充完整的选项是______。 class Person{ private int a; phblic int change(int m){return m;} } public class Teacher extends Person{ public int b; public static void main(String arg[ ]){ Person p=new Person( ); Teacher t=new Teacher( ); int i; ______; } }
执行下列程序之后,变量n的值为______。 public class Test{ public static void main(String[ ]args){ int y=2; int z=3; int n=4; n=n+-y*z/n; System.out.println(n); } }
下列程序中的循环体将会被执行______。 public class ex7 { public static void main(String[] args) { int n=4; while(n<=8) { System.out.println(n); n++; } } }
广告位招租WX:84302438

免费的网站请分享给朋友吧