网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下列关于如下这段代码的说法中正确的是( )。 public class test { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try{ System.out.println("你好吗"); throwit(); System.out.println("出错!"); } finally{ System.out.println("结束"); } } }

A.以上程序段不会编译

B.程序输出“你好吗”,然后有RuntimeException异常发生,输出“出错!”,输出“结束”

C.程序输出“你好吗”,然后有RunfimeException异常发生,然后输出“结束”

D.程序输出“你好吗”,然后输出“结束”,然后有RuntimeException异常发生


参考答案

更多 “ 下列关于如下这段代码的说法中正确的是( )。 public class test { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try{ System.out.println("你好吗"); throwit(); System.out.println("出错!"); } finally{ System.out.println("结束"); } } }A.以上程序段不会编译B.程序输出“你好吗”,然后有RuntimeException异常发生,输出“出错!”,输出“结束”C.程序输出“你好吗”,然后有RunfimeException异常发生,然后输出“结束”D.程序输出“你好吗”,然后输出“结束”,然后有RuntimeException异常发生 ” 相关考题
考题 有如下程序:includeusing namespace std;Class Test{public:Test(){n+=2;}~Test(){n- 有如下程序: #include<iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3

考题 有如下程序:includeusing namespace std;Class Base{public:Base(){cout 有如下程序: #include<iostream.h> using namespace std; Class Base { public: Base(){cout<<“BB”;f();} void{(){cout<<“BF”;} }; class Derived:public Base { public: Derived(){cout<<“DD”;} void f(){cout<<“Df”;) }; int mainA.BBBfDDB.BBDfDDDfC.DDD.DDBBBf

考题 有如下程序:includeusing namespace std;class test{private: int a;public: test( 有如下程序:#include<iostream>using namespace std;class test{private: int a;public: test(){cout<<"constructor"<<endl;} test(int a){cout<<a<<endl;} test(const test_test) { a=_test.a; cout<<"copy constructor"<<en+dl; } ~test(){cout<<"destructor"<<endl;}};int main(){ test A(3); rerun 0;}运行时输出的结果是A.3B.constructor destructorC.copy constructor destructorD.3 destructor

考题 使用VC6打开考生文件夹下的工程test17_1,此工程包含一个源程序文件test17_1.唧,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:Vehicle messageCar messageVehicle message源程序文件test17_1.cpp 清单如下:include <iostream.h>class vehicle{int wheels;float weight;public:/***************** found *****************/void message(void){ cout<<"Vehicle message\n";}};class car:public vehicle{int passenger_load;public:/***************** found *****************/void message (void){cout>>"Car message\n";}};class truck:public vehicle{int passenger_load;float payload;public:int passengers(void){return passenger_load;}};void main(){vehicle * unicycle;unicycle=new vehicle;/***************** found *****************/unicycle.message()delete unicycle;unicycle=new car;unicycle->message();delete unicycle;unicycle=new truck;unicycle->message();delete unicycle;}

考题 下列程序的运行结果是【 】。 include class test { private: int num; public: tes 下列程序的运行结果是【 】。include <iostream. h>class test{private:int num;public:test()int TEST() {return num+100;}~test()};test::test(){num=0;}test::~test(){cout<<"Destructor is active"<<endl;}void main(){test x[3]cout<<x[1]. TEST()<<endl;}

考题 下列程序的运行结果是【 】。 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()}

考题 下列程序的运行结果是______。 include class test { private: int hum; public: tes 下列程序的运行结果是______。include<iostream.h>class test{private:int hum;public:test( );int TEST( ){return num+100;)~test( );};test::test( ){num=0;)test::~test( ){cout<<"Destructor is active"<<endl;)void main( ){test x[3];cout<<x[1].TEST( )<<endl;}

考题 以下关于作用范围的描述正确的是______。A.所有变量(Public/Global/Static/Private)都可以放到窗体的通用部分定义B.所有变量(Public/Global/Static/Private)都可以放到标准模块中定义C.Public/Global类的变量只能放在标准模块中定义D.只有Global变量是必须放在标准模块中定义

考题 阅读以下说明和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;}