classBaseClass{privatefloatx=1.0f;protectedvoidsetVar(floatf){x=f;}}classSubClassextendsBaseClass{privatefloatx=2.0f;//insertcodehere16.}Whichtwoarevalidexamplesofmethodoverriding?()A.VoidsetVar(floatf){x=f;}B.PublicvoidsetVar(intf){x=f;}C.PublicvoidsetVa

题目
classBaseClass{privatefloatx=1.0f;protectedvoidsetVar(floatf){x=f;}}classSubClassextendsBaseClass{privatefloatx=2.0f;//insertcodehere16.}Whichtwoarevalidexamplesofmethodoverriding?()

A.VoidsetVar(floatf){x=f;}

B.PublicvoidsetVar(intf){x=f;}

C.PublicvoidsetVar(floatf){x=f;}

D.PublicdoublesetVar(floatf){x=f;}

E.PublicfinalvoidsetVar(floatf){x=f;}

F.ProtectedfloatsetVar(){x=3.0f;return3.0f;}


相似考题
更多“classBaseClass{privatefloatx=1.0f;protectedvoidsetVar(floatf){x=f;}}classSubClassextendsBaseClass{privatefloatx=2.0f;//insertcodehere16.}Whichtwoarevalidexamplesofmethodoverriding?() ”相关问题
  • 第1题:

    classBaseClass{privatefloatx=1.0f;protectedvoidsetVar(floatf){x=f;}}classSubClassexyendsBaseClass{privatefloatx=2.0f;//insertcodehere8.}Whichtwoarevalidexamplesofmethodoverriding?()

    A.VoidsetVar(floatf){x=f;}

    B.PublicvoidsetVar(intf){x=f;}

    C.PublicvoidsetVar(floatf){x=f;}

    D.PublicdoublesetVar(floatf){x=f;}

    E.PublicfinalvoidsetVar(floatf){x=f;}

    F.ProtectedfloatsetVar(){x=3.0f;return3.0f;}


    参考答案:C, E

  • 第2题:

    下面关于数组定义语句不正确的是______。

    A.inta[]= {1,2,3,4};

    B.int[] a1, a2;

    C.double[] d = new double [8];

    D.float f[] = new {2.0f, 3.5f, 5.6f, 7.8f};


    正确答案:D
    解析:在Java中定义并创建一个数组对象的语句格式是:
      arrayName=new type[arraySize];
      而选项D中,把定义创建数组对象和静态初始化数组对象混为一谈。

  • 第3题:

    11、下面哪些定义是类型正确的?

    A.f :: (Integer, Integer) -> Float f (x,y) = x / y

    B.f :: (Integer, Integer) -> Float f (x,y) = (fromInteger x) / (fromInteger y)

    C.f :: (Integer, Integer) -> Float f (x,y) = 3*x + y

    D.f :: (Integer, Integer) -> Integer f (x, y) = 3*x + y


    AFT 通常由含有一个双氢呋喃环和一个氧杂萘邻酮(香豆素)的基本架构单位构成 AFT 分为 黄曲霉毒素B1(AFB1)、黄曲霉毒素 B2 (AFB2) 黄曲霉毒素G1(AFG1)、黄曲霉毒素 G2(AFG2) 黄曲霉毒素M1(AFM1)、黄曲霉毒素 M2(AFM2) B1、G1的呋喃环氢键异构。M1型氢键变为羟基。 1比2呋喃环上多了一个双键。

  • 第4题:

    下列关于数组定义语句不正确的

    A.int[]a1,a2;

    B.int a[]={1,2,3,4,5};

    C.double[] d=new double[8];

    D.float f[]=new {2.0f,3.5f,5.6f,7.8f};


    正确答案:D
    解析:在Java中定义并创建一个数组对象的语句格式是arrayName=newtype[arraySize);,而选项D)中,把定义创建数组对象和静态初始化数组对象混为一谈。所谓数组的初始化是指对已定义好的数组元素进行赋值。有静态初始化和动态初始化两种。

  • 第5题:

    下列选项中,编译时会出现错误的是()。

    A.double $ d = 6.18 ;

    B.int _i = 100 ;

    C.boolean 1_flag = true ;

    D.float F1= 1.0 f ;


    boolean 1_flag = true ;