niusouti.com

Test2定义如下: 1.publicclassTest1 2.{publicfloataMethod(floata,floatb)throws 3.IOException{} 4.} 5.publicclassTest2extendsTest1{ 6. 7.} 将以下哪种方法插入行6是不合法的。()A.floataMethod(floata,floatb){}B.publicintaMethod(inta,intb)throwsException{}C.publicfloataMethod(floatp

题目
Test2定义如下: 1.publicclassTest1 2.{publicfloataMethod(floata,floatb)throws 3.IOException{} 4.} 5.publicclassTest2extendsTest1{ 6. 7.} 将以下哪种方法插入行6是不合法的。()

A.floataMethod(floata,floatb){}

B.publicintaMethod(inta,intb)throwsException{}

C.publicfloataMethod(floatp,floatq){}

D.publicintaMethod(inta,intb)throwsIOException{}


相似考题
更多“Test2定义如下: 1.publicclassTest1 2.{publicfloataMethod(floata,floatb)throws 3.IOException{} 4.} 5.publicclassTest2extendsTest1{ 6. 7.} 将以下哪种方法插入行6是不合法的。() ”相关问题
  • 第1题:

    类testl定义如下: public class test1 { public float amethod(float a,float b){ } }

    A.public foat amethod(float a,float b,foat c){ }

    B.public float amethod(float c,float d){ }

    C.public int amethod(int a,int b){ }

    D.private float amethod(int a,int b,int c){ }


    正确答案:B

  • 第2题:

    类Test定义如下,将下列哪个方法插入③行处是不合法的( )?

    ① public class Test{

    ② public float Method(float a,float B) { }

    ③ ______

    ④ }

    A.public float Method(float a,float b,float C) { }

    B.public float Method(float c,float d){ }

    C.public int Method(int a,int B) { }private float Method(int a,int b,int C) { }

    D.private float Method(int a,int b,int C) { }


    正确答案:B
    解析:本题主要考查方法重载,方法的重载是指多个方法可以享有相同的名字,但参数的数量或类型必须不相同(采用不同的形式参数列表),选项B不符合方法重载的要求。

  • 第3题:

    将以下哪种方法插入到第6行是不合法的() 。 1.public class Test1 { 2. public float aMethod(float a,float b) throws 3. IOException { } 4. } 5.public class Test2 extends Test1{ 6. 7.}

    A.float aMethod(float a,float b){ }

    B.public int aMethod(int a,int b)throws Exception{ }

    C.public float aMethod(float p,float q){ }

    D.public int aMethod(int a,int b)throws IOException{ }


    DOS

  • 第4题:

    类Test定义如下,将下列()方法插入③行处是不合法的。①publicclassTest{②publicfloatMethod(floata,floatb){}③④}

    A.publicfloatMethod(floata,floatb,floatc){}

    B.pubicfloatMethod(floatc,floatd){}

    C.publicintMethod(inta,intb){}

    D.pivatefloatMethod(inta,intb,intc){}


    正确答案:B

  • 第5题:

    类Test定义如下,将下列哪个方法插入③行处是不合法的? ① public class Test { ② public float Method(float a,float b) { } ③ ④ }

    A.public float Method(float a,float b,float c) { }

    B.public float Method(float c,float d){ }

    C.public int Method(int a,int b){ }

    D.private float Method(int a,int b,int c){ }


    正确答案:B
    解析:此题主要考查方法重载,方法的重载是指多个方法可以享有相同的名字,但参数的数量或类型必须不相同(采用不同的形式参数列表)。选项B)不符合方法重载的要求。