READ Free Dumps For Oracle- 1z0-804
Question ID 21435 | Which two compile?
|
Option A | interface Compilable {
void compile();
}
|
Option B | interface Compilable {
final void compile();
}
|
Option C | interface Compilable {
static void compile();
}
|
Option D | interface Compilable {
abstract void compile();
}
|
Option E | interface Compilable {
protected abstract void compile ();
}
|
Correct Answer | A,D |
Explanation
Question ID 21436 | Which is a key aspect of composition?
|
Option A | Using inheritance
|
Option B | Method delegation
|
Option C | Creating abstract classes
|
Option D | Implementing the composite interface
|
Correct Answer | B |
Explanation Explanation: In the composition approach, the subclass becomes the "front-end class," and the superclass becomes the "back-end class." With inheritance, a subclass automatically inherits an implemenation of any non-private superclass method that it doesn't override. With composition, by contrast, the front-end class must explicitly invoke a corresponding method in the back-end class from its own implementation of the method. This explicit call is sometimes called "forwarding" or "delegating" the method invocation to the back-end object. Note: Composition means the same as: * contains * is part of Note 2: As you progress in an object-oriented design, you will likely encounter objects in the problem domain that contain other objects. In this situation you will be drawn to modeling a similar arrangement in the design of your solution. In an object-oriented design of a Java program, the way in which you model objects that contain other objects is with composition, the act of composing a class out of references to other objects. With composition, references to the constituent objects become fields of the containing object. To use composition in Java, you use instance variables of one object to hold references to other objects.