下列语句序列执行后,k的值是 ( ) public class c9{ public static void main(String[]args){ int a=10,b=18,c=30; switch(b%A) { case 7:c--;break case 8:c-=2;break; case 9:c-=3;break; default : c * =b;break; } System.out.println(C) ; } }A.28B.29C.27D.540

下列语句序列执行后,k的值是 ( ) public class c9{ public static void main(String[]args){ int a=10,b=18,c=30; switch(b%A) { case 7:c--;break case 8:c-=2;break; case 9:c-=3;break; default : c * =b;break; } System.out.println(C) ; } }

A.28

B.29

C.27

D.540


相关考题:

下列程序的运行结果是【 】。 include class SomeClass { public: SomeClass(int va 下列程序的运行结果是【 】。include <iostream. h>class SomeClass{public:SomeClass(int value) { some_value=value;};void show_data(void) { cout<<data<<"<<~some_value<<endl; };static void set_data(int value) {data=value; }private:static int data;int some_value};int SomeClass::datavoid main(void){SomeClass my_class(1001),your_class(2002);your_class. set_data(4004);my_elass. show_data()}

下列语句序列执行后,x的值是_________。publicclasstest{publicstaticvoidmain(string[]args){inta=2;intb=3;intx=4;x=++a*x;system.out.println(x);}} A.13B.10C.11D.12

下面程序段中的错误语句是 ______。 class M{ int i; public: void ~AA(int); AA *p; void AA(); void AA(int x){i=x;}; };A.AA *p;B.void ~AA(int);C.void AA(int);D.void AA(int x){i=x;};

下列语句序列执行后,j的值是______。 public class ex2 { public static void main(String[] args) { int j=2, i=5; while( j<i--) j++; System.out.println(j); } }A.3B.2C.4D.5

下列语句序列执行后,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); } }A.0B.1C.2D.3

下列语句序列执行后,k的值是( )。 public class Test{ public static void main(String[] args) { int m=3, n=6, k=0; while((m++)<(n--)) ++k; System.out.println(k); } }A.0B.1C.2D.3

对于下面程序,对p调用正确的是( )。 class A{ public:fun(int i){cout<<i<<endl;} }; main(){ A a; int k=0; void(A::*p)(int); p=A::fun; }A.a.p(k);B.*a.p(k)C.a.*p(k)D.a::*p(k)

执行下列语句序列后,k的值是(  )。A.0 B.1 C.2 D.3

阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。【Java代码】interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}

阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}