网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下面程序片段的运行结果是( )。 public class Test { public static void main (String args[]) { int a=10,b=4,c=20,d=6; System.out.println (a++ *b+c* --d); } }
A.144
B.160
C.140
D.164
参考答案
更多 “ 下面程序片段的运行结果是( )。 public class Test { public static void main (String args[]) { int a=10,b=4,c=20,d=6; System.out.println (a++ *b+c* --d); } }A.144B.160C.140D.164 ” 相关考题
考题
下面程序的运行结果是【】。 inChlde using namespace std; class count { static int n;
下面程序的运行结果是【 】。inChlde<iOStream>using namespace std;class count{static int n;public:count(){n++;}static int test(){for(int i=0:i<4;i++)n++;return n;}};int count::n=0;int main(){cout<<COUnt::test()<<" ";count c1, c2;cout<<count::test()<<end1;return 0;}
考题
下面程序的运行结果是【】。 include using namespace std; class count{ static int n;
下面程序的运行结果是【 】。include <iostream>using namespace std;class count{static int n;public:count(){n++;}static int test(){for(int i=0;i<4;i++)n++;return n;}};int count::n = O;int main(){cout<<count:: test()<<" ";count c1, c2;cout<<count:: test()<<endl;return 0;}
考题
下列程序的运行结果是【 】。 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;}
考题
下列程序的运行结果是______。include class Base { public: void f(int x){cout
下列程序的运行结果是______。include<iostream.h>class Base{public:void f(int x){cout<<“Base:”<<x<<endl;});class Derived:public Base{public:void f(char*str){cout<<“Derived:”<<str<<endl;}};void main(void){Base*pd=ne
考题
下面程序的运行结果是()。includeusing namespace std;class TestClass{static int n;
下面程序的运行结果是( )。 #include<iostream> using namespace std; class TestClass { static int n; public: TestClass () { n++; } static int test() { for(int i=0;i<4;i++) n++; return n; } }; int TestClass::n=0; int main() { cout<<TestClass::test()<<" "; TestClass c1,c2; cout<<TestClass::test()<<endl; return (); }A.4,10B.4,6C.0,6D.0,4
考题
阅读以下说明和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();? ?}}
考题
下面程序片段的运行结果是()。 public static void main(String[] args) { int i=1, num=0; while(i<=10) { if (i%3==0) { num=num+1;} i++; } System.out.print(num); }A.3B.2C.1D.0
考题
3、下面程序片段的运行结果是()。public static void main(String[] args) { int i=1, num=0; while(i<=10) { if (i%3==0) { num=num+1;} i++; } System.out.print(num); }A.3B.2C.1D.0
热门标签
最新试卷