In which two cases does the compiler supply a default constructor for class A?()  A、 class A{}B、 class A { public A(){} }C、 class A { public A(int x){} }D、 class Z {} class A extends Z { void A(){} }

题目

In which two cases does the compiler supply a default constructor for class A?()  

  • A、 class A{}
  • B、 class A { public A(){} }
  • C、 class A { public A(int x){} }
  • D、 class Z {} class A extends Z { void A(){} }

相似考题
更多“In which two cases does the compiler supply a default constructor for class A?()  A、 class A{}B、 class A { public A(){} }C、 class A { public A(int x){} }D、 class Z {} class A extends Z { void A(){} }”相关问题
  • 第1题:

    Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }  

    • A、The code will fail to compile.
    • B、The constructor in a that takes an int as an argument will never be called as a result of constructing an     object of class b or c.
    • C、Class c has three constructors.
    • D、Objects of class b cannot be constructed.
    • E、At most one of the constructors of each class is called as a result of constructing an object of class c.

    正确答案:B,C

  • 第2题:

    Which two allow the class Thing to be instantiated using new Thing()?

    • A、 public class Thing { }
    • B、 public class Thing { public Thing() {} }
    • C、 public class Thing { public Thing(void) {} }
    • D、 public class Thing { public Thing(String s) {} }
    • E、 public class Thing { public void Thing() {} public Thing(String s) {} }

    正确答案:A,B

  • 第3题:

    public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()

    • A、 public void aMethod() {}
    • B、 private void aMethod() {}
    • C、 public void aMethod(String s) {}
    • D、 private Y aMethod() { return null; }
    • E、 public X aMethod() { return new Y(); }

    正确答案:C,E

  • 第4题:

    public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()   

    • A、 ConstOver ( ) { }
    • B、 Protected int ConstOver ( ) { }
    • C、 Private ConstOver (int z, int y, byte x) { }
    • D、 Public Object ConstOver (int x, int y, int z) { }
    • E、 Public void ConstOver (byte x, byte y, byte z) { }

    正确答案:A,C

  • 第5题:

    Which two demonstrate an “is a” relationship?()   

    • A、 public interface Person { }  public class Employee extends Person { }
    • B、 public interface Shape { }  public class Employee extends Shape { }
    • C、 public interface Color { }  public class Employee extends Color { }
    • D、 public class Species { }  public class Animal (private Species species;)
    • E、 interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

    正确答案:D,E

  • 第6题:

    public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()

    • A、 public class Circle implements Shape { private int radius; }
    • B、 public abstract class Circle extends Shape { private int radius; }
    • C、 public class Circle extends Shape { private int radius; public void draw(); }
    • D、 public abstract class Circle implements Shape { private int radius; public void draw(); }
    • E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }
    • F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

    正确答案:B,E

  • 第7题:

    多选题
    Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }
    A

    The code will fail to compile.

    B

    The constructor in a that takes an int as an argument will never be called as a result of constructing an     object of class b or c.

    C

    Class c has three constructors.

    D

    Objects of class b cannot be constructed.

    E

    At most one of the constructors of each class is called as a result of constructing an object of class c.


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

  • 第8题:

    多选题
    public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()
    A

    public void aMethod() {}

    B

    private void aMethod() {}

    C

    public void aMethod(String s) {}

    D

    private Y aMethod() { return null; }

    E

    public X aMethod() { return new Y(); }


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

  • 第9题:

    多选题
    class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()
    A

    public void foo() { }

    B

    public int foo() { return 3; }

    C

    public Two foo() { return this; }

    D

    public One foo() { return this; }

    E

    public Object foo() { return this; }


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

  • 第10题:

    多选题
    public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()
    A

    public class Circle implements Shape { private int radius; }

    B

    public abstract class Circle extends Shape { private int radius; }

    C

    public class Circle extends Shape { private int radius; public void draw(); }

    D

    public abstract class Circle implements Shape { private int radius; public void draw(); }

    E

    public class Circle extends Shape { private int radius;public void draw() {/* code here */} }

    F

    public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }


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

  • 第11题:

    多选题
    Which two statements are true regarding the creation of a default constructor?()
    A

    The default constructor initializes method variables.

    B

    The compiler always creates a default constructor for every class.

    C

    The default constructor invokes the no-parameter constructor of the superclass.

    D

    The default constructor initializes the instance variables declared in the class.

    E

    When a class has only constructors with parameters, the compiler does not create a default constructor.


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

  • 第12题:

    多选题
    Which two allow the class Thing to be instantiated using new Thing()?
    A

    public class Thing { }

    B

    public class Thing { public Thing() {} }

    C

    public class Thing { public Thing(void) {} }

    D

    public class Thing { public Thing(String s) {} }

    E

    public class Thing { public void Thing() {} public Thing(String s) {} }


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

  • 第13题:

    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() 

    • A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }
    • B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }
    • C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
    • D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
    • E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
    • F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

    正确答案:A

  • 第14题:

    Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?()   class A {}   class B extends A {}   class C extends A {}   public class Q3ae4 {   public static void main(String args[]) {   A x = new A();   B y = new B();   C z = new C();   // insert statement here   }   } 

    • A、x = y;
    • B、z = x;
    • C、y = (B) x;
    • D、z = (C) y;
    • E、y = (A) y;

    正确答案:C

  • 第15题:

    class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()

    • A、 public void foo() { }
    • B、 public int foo() { return 3; }
    • C、 public Two foo() { return this; }
    • D、 public One foo() { return this; }
    • E、 public Object foo() { return this; }

    正确答案:C,D

  • 第16题:

    Given:  1.  public class ConstOver {  2.  public constOver(int x, int y, int z) {  3.  }  4.  }   Which two overload the ConstOver Constructor?()

    • A、 ConstOver() {}
    • B、 protected int ConstOver(){}
    • C、 private ConstOver(int z, int y, byte x ) {}
    • D、 public Object ConstOver(Int x, int y, int z) {}
    • E、 pubic void ConstOver (byte x, byte y, byte z) {}

    正确答案:A,C

  • 第17题:

    What produces a compiler error?()  

    • A、 class A { public A(int x) {} }
    • B、 class A {} class B extends A { B() {} }
    • C、 class A { A() {} } class B { public B() {} }
    • D、 class Z { public Z(int) {} } class A extends Z {}

    正确答案:D

  • 第18题:

    多选题
    Which two demonstrate an “is a” relationship?()
    A

    public interface Person { }  public class Employee extends Person { }

    B

    public interface Shape { }  public class Employee extends Shape { }

    C

    public interface Color { }  public class Employee extends Color { }

    D

    public class Species { }  public class Animal (private Species species;)

    E

    interface Component { }  Class Container implements Component ( Private Component[ ] children;  )


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

  • 第19题:

    多选题
    public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()
    A

    ConstOver ( ) { }

    B

    Protected int ConstOver ( ) { }

    C

    Private ConstOver (int z, int y, byte x) { }

    D

    Public Object ConstOver (int x, int y, int z) { }

    E

    Public void ConstOver (byte x, byte y, byte z) { }


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

  • 第20题:

    多选题
    In which two cases does the compiler supply a default constructor for class A?()
    A

    class A{}

    B

    class A { public A(){} }

    C

    class A { public A(int x){} }

    D

    class Z {} class A extends Z { void A(){} }


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

  • 第21题:

    单选题
    public class SomeException {  } Class a:  public class a {  public void doSomething() { }  } Class b:  public class b extends a {  public void doSomething() throws SomeException { }  }  Which is true about the two classes?()
    A

     Compilation of both classes will fail.

    B

     Compilation of both classes will succeed.

    C

     Compilation of class a will fail. Compilation of class b will succeed.

    D

     Compilation of class a will fail. Compilation of class a will succeed.


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

  • 第22题:

    单选题
    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()
    A

     public class Employee extends Info implements Data { public void load() { /*do something*/ } }

    B

     public class Employee implements Info extends Data { public void load() { /*do something*/ } }

    C

     public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }

    D

     public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }

    E

     public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }

    F

     public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }


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

  • 第23题:

    单选题
    What produces a compiler error?()
    A

     class A { public A(int x) {} }

    B

     class A {} class B extends A { B() {} }

    C

     class A { A() {} } class B { public B() {} }

    D

     class Z { public Z(int) {} } class A extends Z {}


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