Which two are true about has-a and is-a relationships?()
AInheritance represents an is-a relationship.
BInheritance represents a has-a relationship.
CInterfaces must be used when creating a has-a relationship.
DInstance variables can be used when creating a has-a relationship.
相关问题推荐
-
Which method will complete this class?()
A、 public int compareTo(Object o){/* more code here */}
B、 public int compareTo(Score other){/* more code here */}
C、 public int compare(Score s1, Score s2){/* more code here */}
D、 public int compare(Object o1, Object o2){/* more code here */}
-
public class Foo implements Runnable ( public void run (Thread t) { system.out.printIn(“Running.”); } public static void main (String[] args) { new thread (new Foo()).start(); } ) What is the result?()
A、 An exception is thrown.
B、 The program exists without printing anything.
C、 An error at line 1 causes compilation to fail.
D、 An error at line 2 causes the compilation to fail.
E、 “Running” is printed and the program exits.
-
int x=0; int y 10; do { y--; ++x; } while (x
A、 5,6
B、 5,5
C、 6,5
D、 6,6
-
class A { public A() { System.out.println(“hello from a”); } } class B extends A { public B () { System.out.println(“hello from b”); super(); } } public class Test { public static void main(String args[]) { A a = new B(); } } What is the result when main is executed?()
A、 Compilation fails.
B、 hello from a
C、 hello from b
D、 hello from b hello from a
E、 hello from a hello from b
-
Which capability exists only in java.io.BufferedWriter?()
A、Closing an open stream.
B、Flushing an open stream.
C、Writing to an open stream.
D、Writing a line separator to an open stream.