阅读下列代码 public class Test { public static void main(String args[]) { String s = "Test"; switch (s) { case "Java": System.out.print("Java"); break; case "Language": System.out.print("Language"); break; case "Test": System.out.print("Test"); break; } } } 其运行结果是( )。A.JavaB.LanguageC.TestD.编译出错

阅读下列代码 public class Test { public static void main(String args[]) { String s = "Test"; switch (s) { case "Java": System.out.print("Java"); break; case "Language": System.out.print("Language"); break; case "Test": System.out.print("Test"); break; } } } 其运行结果是( )。

A.Java

B.Language

C.Test

D.编译出错


相关考题:

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

清在下划线处填入代码,使程序正常运行并且输出“Hello!”classTesl______{publicstaticvoidmain(string[]args){Test=newTest();t.start();}Pubhcvoidrun(){System.out.println("Hello!");}}

有下列程序: include using namespace std; classTest{ public: Test(){n+=2;} ~Test 有下列程序: #include<iostream> using namespace std; classTest{ 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 TestA.n=0B.n=lC.n=2D.n=3

已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string other);//拷贝构造函数---string(void);string operate=(const string other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述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();? ?}}

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

阅读下列代码,选出该代码段正确的文件名()。 class A{ void method1(){ System.out.println("Method1 in class A"); } } public class B{ void method2(){ System.out.println("Method2 in class B"); } public static void main(String[] args){ System.out.println("main() in class B"); } }A.javaB.A.classC.B.javaD.B.class

以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)

Java程序中,main方法的格式正确的是()。A.static void main (string[] args)B.public void main (string[] s)C.public static main (string[] args)D.public static void main (string[] args)