A. program in the general.
B. program in the specific.
C. absorb attributes and behavior from previous classes.
D. hide information from the user. d. hide information from the user.
A. An interface describes a set of methods that can be called on an object, providing a default implementation for the methods.
B. An interface describes a set of methods that can be called on an object, not providing concrete implementation for the methods.
C. Interfaces are useful when attempting to assign common functionality to possibly unrelated classes.
D. Once a class implements an interface, all objects of that class have an is-a relationship with the interface type.
A. A billing program where there is a variety of client types that are billed with different fee structures.
B. A maintenance log program where data for a variety of types of machines is collected and maintenance schedules are produced for each machine based on the data collected.
C. A program to compute a 5% savings account interest for a variety of clients.
D. An IRS program that maintains information on a variety of taxpayers and determines who to audit based on criteria for classes of taxpayers.
A. A subclass reference cannot be assigned to a superclass variable and a superclass reference cannot be assigned to a subclass variable.
B. A subclass reference can be assigned to a superclass variable and a superclass reference can be assigned to a subclass variable.
C. A superclass reference can be assigned to a subclass variable, but a subclass reference cannot be assigned to a superclass variable.
D. A subclass reference can be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable.
A. real classes.
B. instance classes.
C. implementable classes.
D. concrete classes.
C. a diamond.
D. there is no convention of the UML to denote abstract classes—they are listed just as any other class.
A. implementation inheritance.
B. interface inheritance.
C. Both. d. Neither.
A. public int method1();
B. public int abstract method1();
C. public abstract int method1();
D. public int nonfinal method1();
A. abstract superclasses may contain data.
B. abstract superclasses may not contain implementations of methods.
C. abstract superclasses must declare all methods as abstract.
D. abstract superclasses must declare all data members not given values as abstract.
A. Must implement a method called calculate.
B. Will not be able to access the instance variable a.
C. Neither (a) nor (b).
D. Both (a) and (b)
A. Method originalMethod cannot be overridden in class C—once it has been implemented in concrete class B, it is implicitly final.
B. Method originalMethod must be overridden in class C, or a syntax error will occur.
C. If method originalMethod is not overridden in class C but is called by an object of class C, an error occurs.
D. None of the above.
A. execution time binding.
B. execution binding.
C. just-in-time binding.
D. late binding.
A. because the subclass object has an object of its superclass.
B. because the subclass object is an object of its superclass.
C. only when the superclass is abstract.
D. only when the superclass is concrete.
A. final methods allow inlining the code.
B. final methods and classes prevent further inheritance.
C. final methods are static.
D. final methods can improve performance.
A. a method in an abstract class.
B. a private method.
C. a method declared in a final class.
D. static method.
A. it will prepare the object for garbage collection.
B. it cannot be accessed from outside its class.
C. it cannot be overloaded.
D. it cannot be overridden.
A. private static data and public abstract methods.
B. only public abstract methods.
C. public static final data and public abstract methods.
D. private static data and public final methods.
A. forces classes that implement it to declare all the interface methods.
B. can be used in place of an abstract class when there is no default implementation to inherit.
C. is declared in a file by itself and is saved in a file with the same name as the interface followed by the .java extension.
D. can be instantiated.
D. any number of
A. A class that implements two interfaces.
B. A class that inherits from two classes.
C. A class that inherits from one class, and implements an interface.
D. All of the above are possible.
D. All of the above.