In which two cases does the compiler supply a default constructor for class 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) {} }
第2题:
Which two allow the class Thing to be instantiated using new Thing()?
第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?()
第4题:
public class ConstOver { public ConstOver (int x, int y, int z) { } } Which two overload the ConstOver constructor?()
第5题:
Which two demonstrate an “is a” relationship?()
第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?()
第7题:
The code will fail to compile.
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.
Class c has three constructors.
Objects of class b cannot be constructed.
At most one of the constructors of each class is called as a result of constructing an object of class c.
第8题:
public void aMethod() {}
private void aMethod() {}
public void aMethod(String s) {}
private Y aMethod() { return null; }
public X aMethod() { return new Y(); }
第9题:
public void foo() { }
public int foo() { return 3; }
public Two foo() { return this; }
public One foo() { return this; }
public Object foo() { return this; }
第10题:
public class Circle implements Shape { private int radius; }
public abstract class Circle extends Shape { private int radius; }
public class Circle extends Shape { private int radius; public void draw(); }
public abstract class Circle implements Shape { private int radius; public void draw(); }
public class Circle extends Shape { private int radius;public void draw() {/* code here */} }
public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }
第11题:
The default constructor initializes method variables.
The compiler always creates a default constructor for every class.
The default constructor invokes the no-parameter constructor of the superclass.
The default constructor initializes the instance variables declared in the class.
When a class has only constructors with parameters, the compiler does not create a default constructor.
第12题:
public class Thing { }
public class Thing { public Thing() {} }
public class Thing { public Thing(void) {} }
public class Thing { public Thing(String s) {} }
public class Thing { public void Thing() {} public Thing(String s) {} }
第13题:
interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
第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 } }
第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?()
第16题:
Given: 1. public class ConstOver { 2. public constOver(int x, int y, int z) { 3. } 4. } Which two overload the ConstOver Constructor?()
第17题:
What produces a compiler error?()
第18题:
public interface Person { } public class Employee extends Person { }
public interface Shape { } public class Employee extends Shape { }
public interface Color { } public class Employee extends Color { }
public class Species { } public class Animal (private Species species;)
interface Component { } Class Container implements Component ( Private Component[ ] children; )
第19题:
ConstOver ( ) { }
Protected int ConstOver ( ) { }
Private ConstOver (int z, int y, byte x) { }
Public Object ConstOver (int x, int y, int z) { }
Public void ConstOver (byte x, byte y, byte z) { }
第20题:
class A{}
class A { public A(){} }
class A { public A(int x){} }
class Z {} class A extends Z { void A(){} }
第21题:
Compilation of both classes will fail.
Compilation of both classes will succeed.
Compilation of class a will fail. Compilation of class b will succeed.
Compilation of class a will fail. Compilation of class a will succeed.
第22题:
public class Employee extends Info implements Data { public void load() { /*do something*/ } }
public class Employee implements Info extends Data { public void load() { /*do something*/ } }
public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
第23题:
class A { public A(int x) {} }
class A {} class B extends A { B() {} }
class A { A() {} } class B { public B() {} }
class Z { public Z(int) {} } class A extends Z {}