niusouti.com

类Test定义如下,将下列( )方法插入③行处是不合法的。 ①publicClass Test{ ②public float Method(floatA,float b){} ③ ④}A.public float Method(floatA,float b,floatC){}B.public float Method(noatC,float d) {}C.public int Method(intA,int b){}D.private float Method(intA,int b,intC){}

题目

类Test定义如下,将下列( )方法插入③行处是不合法的。 ①publicClass Test{ ②public float Method(floatA,float b){} ③ ④}

A.public float Method(floatA,float b,floatC){}

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

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

D.private float Method(intA,int b,intC){}


相似考题
更多“类Test定义如下,将下列( )方法插入③行处是不合法的。 ①publicClass Test{ ②public float Method(floatA,float b){} ③ ④}A.public float Method(floatA,float b,floatC){}B.public float Method(noatC,float d) {}C.public int Method(intA,int b){}D.private float Method(intA,int b,intC){}”相关问题
  • 第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题:

    下列重载函数中,正确的是( )。

    A.void fun(int a,float b);void fun(int C,float d)

    B.void fun(int a,float b);void fun(float a,int b)

    C.float fun(int a,float b);int fun(int b,float a)

    D.int fun(int a,int b);float fun(int a,int b)


    正确答案:B

  • 第3题:

    Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?

    • A、 private void set Var(int a, float c, int b) {}
    • B、 protected void set Var(int a, int b, float c) {}
    • C、 public int set Var(int a, float c, int b) {return a:}
    • D、 public int set Var(int a, int b, float c) {return a:}
    • E、 protected float set Var(int a, int b, float c) {return c:}

    正确答案:A,C

  • 第4题:

    下面的方法重载,正确的是()。

    • A、int fun(int a, float b) { }  float fun(int a, float b) { }
    • B、float fun(int a, float b) { } float fun(int x, float y) { }
    • C、float fun(float a) { }  float fun(float a, float b) { }
    • D、float fun1(int a, float b) { }  float fun2(int a, float b) { }

    正确答案:C

  • 第5题:

    判断下列语句在mel中正确的是()。

    • A、Flao $int
    • B、float int
    • C、int &num
    • D、float $int

    正确答案:D

  • 第6题:

    类Test1定义如下:1.publicclassTest1{2.publicfloataMethod(floata,floatb){}3.4.}将以下()方法插入行3是不合法的。

    • A、public float aMethod(floata,floatb,floatc){}
    • B、public float aMethod(floatc,floatd){}
    • C、public int aMethod(inta,intb){}
    • D、private float aMethod(inta,intb,intc){}

    正确答案:B

  • 第7题:

    public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()

    • A、 void setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }
    • B、 public void setVar(int a, float c, int b) {  setVar(a, b, c);  }
    • C、 public void setVar(int a, float c, int b) {  this(a, b, c);  }
    • D、 public void setVar(int a, float b){  x = a;  z = b;  }
    • E、 public void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }

    正确答案:B,D

  • 第8题:

    多选题
    public class MethodOver  {  public void setVar (int a, int b, float c)  {  }  }   Which two overload the setVar method?()
    A

    Private void setVar (int a, float c, int b)  { }

    B

    Protected void setVar (int a, int b, float c) { }

    C

    Public int setVar (int a, float c, int b) (return a;)

    D

    Public int setVar (int a, int b, float c) (return a;)

    E

    Protected float setVar (int a, int b, float c) (return c;)


    正确答案: D,C
    解析: 暂无解析

  • 第9题:

    单选题
    类Test1定义如下:1.publicclassTest1{2.publicfloataMethod(floata,floatb){}3.4.}将以下()方法插入行3是不合法的。
    A

    public float aMethod(floata,floatb,floatc){}

    B

    public float aMethod(floatc,floatd){}

    C

    public int aMethod(inta,intb){}

    D

    private float aMethod(inta,intb,intc){}


    正确答案: A
    解析: 暂无解析

  • 第10题:

    单选题
    下面的方法重载,正确的是()。
    A

    int fun(int a, float b) { }  float fun(int a, float b) { }

    B

    float fun(int a, float b) { } float fun(int x, float y) { }

    C

    float fun(float a) { }  float fun(float a, float b) { }

    D

    float fun1(int a, float b) { }  float fun2(int a, float b) { }


    正确答案: A
    解析: 暂无解析

  • 第11题:

    多选题
    Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?
    A

    private void set Var(int a, float c, int b) {}

    B

    protected void set Var(int a, int b, float c) {}

    C

    public int set Var(int a, float c, int b) {return a:}

    D

    public int set Var(int a, int b, float c) {return a:}

    E

    protected float set Var(int a, int b, float c) {return c:}


    正确答案: A,C
    解析: 暂无解析

  • 第12题:

    ( 难度:中等)下面哪个函数是 public void example(){...} 的重载函数?
    A.private void example( int m){...}
    B.public int example(){...}
    C.public void example2(){...}
    D.public int example ( int m, float f){...}
    E.public int example ( int m, float f, int cc){...}

    答案:DE

  • 第13题:

    类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不符合方法重载的要求。

  • 第14题:

    下面程序输出的结果是( )。 include using namespace std; int test(int n1

    下面程序输出的结果是( )。 #include<iostream> using namespace std; int test(int n1,int n2) {return n1 +n2;} float test (int f1,float f2){return f1-f2;} float test(float x,float y){return(x+y)/2;} float test(float x,int y){return(x+y)*2;} void main(){ int a1=10; float a2=2.5f; cout<<test(a1,a2); }

    A.12.5

    B.7.5

    C.6.25

    D.25


    正确答案:B
    解析:此处为函数的重载,第一个参数为int,第二个参数为float,故执行第二个函数。

  • 第15题:

    类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()

    • A、public float aMethod(float a, float b,float c){ return 0;}
    • B、public float aMethod(float c,float d){ return 0;}
    • C、public int aMethod(int a, int b){ return 0;}
    • D、private float aMethod(int a,int b,int c){ return 0;}

    正确答案:B

  • 第16题:

    下列定义形式错误的是()

    • A、floata[]
    • B、floata[5]
    • C、inta[]=newint[5]
    • D、float[]c

    正确答案:B

  • 第17题:

    整型指针变量定义正确的是()

    • A、inta*;
    • B、int*a;
    • C、int*a,*b;
    • D、float*a;

    正确答案:B,C

  • 第18题:

    class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()        

    • A、 Void setVar(float f) {x = f;}
    • B、 Public void setVar(int f) {x = f;}
    • C、 Public void setVar(float f) {x = f;}
    • D、 Public double setVar(float f) {x = f;}
    • E、 Public final void setVar(float f) {x = f;}
    • F、 Protected float setVar() {x=3.0f; return 3.0f; }

    正确答案:C,E

  • 第19题:

    public class MethodOver  {  public void setVar (int a, int b, float c)  {  }  }   Which two overload the setVar method?()  

    • A、 Private void setVar (int a, float c, int b)  { }
    • B、 Protected void setVar (int a, int b, float c) { }
    • C、 Public int setVar (int a, float c, int b) (return a;)
    • D、 Public int setVar (int a, int b, float c) (return a;)
    • E、 Protected float setVar (int a, int b, float c) (return c;)

    正确答案:A,C

  • 第20题:

    单选题
    下列重载函数中,正确的是(  )。
    A

    void fun(int a,float b);void fun(int C,float d)

    B

    void fun(int a,float b);void fun(float a,int b)

    C

    float fun(int a,float b);int fun(int b,float a)

    D

    int fun(int a,int b);float fun(int a,int b)


    正确答案: D
    解析:
    函数重载是指同一函数名可以对应多个函数实现。进行函数重载时,要求同名函数在参数个数上不同,或者参数类型上不同,只有返回类型不同的函数不能重载。

  • 第21题:

    单选题
    类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()
    A

    public float aMethod(float a, float b,float c){ return 0;}

    B

    public float aMethod(float c,float d){ return 0;}

    C

    public int aMethod(int a, int b){ return 0;}

    D

    private float aMethod(int a,int b,int c){ return 0;}


    正确答案: D
    解析: 暂无解析

  • 第22题:

    多选题
    public class MethodOver {  private int x, y;  private float z;  public void setVar(int a, int b, float c){  x = a;  y = b;  z = c;  }  }   Which two overload the setVar method?()
    A

    void setVar (int a, int b, float c){ x = a; y = b; z = c; }

    B

    public void setVar(int a, float c, int b) { setVar(a, b, c); }

    C

    public void setVar(int a, float c, int b) { this(a, b, c); }

    D

    public void setVar(int a, float b){ x = a; z = b; }

    E

    public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }


    正确答案: A,B
    解析: 暂无解析

  • 第23题:

    多选题
    class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()
    A

    Void setVar(float f) {x = f;}

    B

    Public void setVar(int f) {x = f;}

    C

    Public void setVar(float f) {x = f;}

    D

    Public double setVar(float f) {x = f;}

    E

    Public final void setVar(float f) {x = f;}

    F

    Protected float setVar() {x=3.0f; return 3.0f; }


    正确答案: E,B
    解析: 暂无解析