对下列程序的叙述中,正确的是1:public class X extends Thread implements Runnable{2:publ主c void run(){3: System.out.println(“this is run()”);4:}5:public static void main(String args〔〕){6:Threadt二new Thread(new X());7:t.start();8:}9:}A.第1行会产生编译错误B.第6行会产生编译错误C.第6行会产生运行错误D.程序正常运行

对下列程序的叙述中,正确的是

1:public class X extends Thread implements Runnable{

2:publ主c void run(){

3: System.out.println(“this is run()”);

4:}

5:public static void main(String args〔〕){

6:Threadt二new Thread(new X());

7:t.start();

8:}

9:}

A.第1行会产生编译错误

B.第6行会产生编译错误

C.第6行会产生运行错误

D.程序正常运行


相关考题:

当使用SomeThread t=new SomeThread()创建一个线程时,下列叙述中正确的是( )。A.SomeThread类是包含run()方法的任意Java类B.SomeThread类一定要实现Runnable接口C.SomeThread类是Thread类的子类D.SomeThread类是Thread类的子类并且要实现Runnable接口

如果使用 Thread t = new Test() 语句创建一个线程,则下列叙述正确的是A)Test 类一定要实现 Runnable 接口B)Test 类一定是 Thread 类的子类C)Test 类一定是 Runnable 的子类D)Test 类一定是继承 Thread 类并且实现 Runnable 接口

当使用SomeThread t=new SomeThread()创建一个线程时,下列叙述中正确的是A.SomeThread类是包含run()方法的任意Java类B.SomeThread类一定要实现Runnable接口C.SomeThread类是Thread类的子类D.SomeThread类是Thread类的子类并且要实现Runnable接口

如果使用Thread t=new Test()语句创建一个线程,则下列叙述正确的是A.Test类一定要实现Runnable接口B.Test类一定是Thread类的子类C.Test类一定是Runnable的子类D.Test类一定是继承Thread类并且实现Runnable接口

下面程序中错误之处是 ______。 include classA{private:intxl;protected:intx2;publ 下面程序中错误之处是 ______。include<iostream.h>class A{private:int xl;protected:int x2;public:int x3;};class B: public A{private:int b1;protected:int b2;public:int b3;void disp(){cout<<x1<<b2<<end1;} //Avoid set(int i){x3=i;} //B};void main()B bb;bb. a3=10 //Cbb. b3=10 //D}

当使用SomeThread t=new SomeThread创建一个线程时,下列叙述中正确的是( )。A.SomeThread类是包含run方法的任意Java类B.SomeThread类一定要实现Runnable接口C.SomeThread类是Thread类的子类D.SomeThread类是Thread类的子类并且要实现Runnable接口

下列程序的执行结果是______。 include include class TestClass { publ 下列程序的执行结果是______。 #include<iostream.h> #include<stdlib.h> class TestClass { public: int x,y; TestClass () {x=y=0;} TestClass (int a,int b){x=a;y=b;} void disp() { cout<<"x="<<x<<",y="<<y<<end1; } void main() TestClass s1(2,3); s1.disp(); }A.x=2,y=2B.x=2,y=3C.x=3,y=2D.x=3,y=3

请在下列程序的横线处填写正确的语句。include using namespace std; class Base{ publ 请在下列程序的横线处填写正确的语句。include<iostream>using namespace std;class Base{public:void fun(){cout<<"Base fun"<<endl;}};class Derivde:public Base{public:void fun(){______∥ 调用基类的函数

( 29 )当使用 SomeThread t=new SomeThread() 创建一个线程时,下列叙述中正确的是A ) SomeThread 类是包含 run() 方法的任意 java 类B ) SomeThread 类一定要实现 Runnable 接口C ) SomeThread 类是 Thread 类的子类D ) SomeThread 类是 Thread 类的子类并且要实现 Runnable 接口

阅读以下说明和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();? ?}}