阅读下面程序class Test implements Runnable{public static void main(String[] args){Test t = new Test();t.start();}public void run(){ }}下列关于上述程序的叙述正确的是A) 程序不能通过编译,因为 start() 方法在 Test 类中没有定义B) 程序编译通过,但运行时出错,提示 start() 方法没有定义C) 程序不能通过编译,因为 run() 方法没有定义方法体D) 程序编译通过,且运行正常

阅读下面程序

class Test implements Runnable{

public static void main(String[] args){

Test t = new Test();

t.start();

}

public void run(){ }

}

下列关于上述程序的叙述正确的是

A) 程序不能通过编译,因为 start() 方法在 Test 类中没有定义

B) 程序编译通过,但运行时出错,提示 start() 方法没有定义

C) 程序不能通过编译,因为 run() 方法没有定义方法体

D) 程序编译通过,且运行正常


相关考题:

请阅读下面程序 public class ExampleStringBuffer{ public static void main(String []args){ StringBuffer sb=new StringBuffer("test"); System.out.println("buffer="+sB) ; System.out.println("length="+sb.length());} } 程序运行结果中在"length="后输出的值A.10B.4C.20D.30

请阅读下面的程序classTest/{privatestaticStringname;static/{name="World";System.out.print(name);/}publicstaticvoidmain(String[]args)/{System.out.print("Hello");Testtest=newTest();/}/}下列选项中,程序运行结果是()。:A.WorldB.HelloC.World HelloD.Hello World

请阅读下面程序 public class ExampleStringBuffer{ public static void main(String[]args){ StringBuffer sb=new StringBuffer("test"); System.OUt.println("buffer="+sb); System.OUt.println("length="+sb.length );}} 程序运行结果中在"length="后输出的值是( )。A.10B.4C.20D.30

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

作为Java应用程序入口的main方法,其声明格式可以是( )。A、publicstaticvoidmain(String[]args)B、publicstaticintmain(String[]args)C、publicvoidmain(String[]args)D、publicintmain(String[]args)

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

Java程序中,main方法的格式正确的是()A.public static void main(String[] args)B.public static main(String[] args)C.public void main(String[] args)D.static 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)

main方法是Java应用程序执行的入口点,下面main方法的方法头合法的是()A.public static void main()B.public static void main(String[] args)C.public static void Main(String[] args)D.public static int main(String[] args)