编程题:Class father{fathe() {}Class sun extends father{ son() {…..}Public static void main(){ son a=new father();}}此程序是否正确,为什么?

编程题:

Class father{fathe() {}

Class sun extends father

{ son() {…..}

Public static void main()

{ son a=new father();

}

}

此程序是否正确,为什么?


相关考题:

在J2EE中,通过调用以下()方法,可以装载SUN的JDBC-ODBC桥。 A.class.forname(“sun.jdbc.odbc.JdbcOdbcDriver”);B.class.forName(“sun.jdbcodbcDriver”);C.Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);D.Class.forname(“sun.jdbc.jdbcOdbcDriver”);

在Jaee中,通过调用一下()方法,可以装载sun的JDBC-ODBC桥。 A.class.forname(sun.jdbc.odbc.JdbcOdbcDriver)B.class.forName(sun.jdbcodbcDriver)C.Class.forName(sun.jdbc.odbc.JdbcOdbcDriver)D.Class.forname(sun.jdbc.JdbcOdbcDriver)

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

用于定义类成员的访问控制权限的一组关键字是A.extends 和 implementsB.public,private 和 protectedC.class和publicD.char,int,float和double

对于下面( )类定义,可以通过“newJ_Class()”生成类J_Class的实例对象。A、publicclassJ_Class{publicJ_Class(void){}}B、publicclassJ_Class{}C、publicclassJ_Class{publicJ_Class(Strings){}}D、publicclassJ_Class{publicvoidJ_Class(){}publicJ_Class(Strings){}

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

Father和Son是两个java类,下列哪一选项正确的标识出Father是Son的父类:A.class Son implements FatherB.class Father implements SonC.class Father extends SonD.class Son extends Father

12、在JAVA中,通过调用以下()方法,可以装载SUN的JDBC-ODBC桥。A.new Class() .load(“sun.jdbc.odbc.jdbcodbcDriber”) ;B.new Class() .forName(“sun.jdbc.odbc.JdbcOdbcDriver”) ;C.Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”) ;D.Class.load(“sun.jdbc.odbc.JdbcOdbcDriver”) ;

Father和Son是两个java类,下列哪一选项正确的标识出Father是Son的父类?()。A.class Son implements FatherB.class Father implements SonC.class Father extends SonD.class Son extends Father