READ Free Dumps For Oracle- 1z0-804
Question ID 21419 | Given:
interface Books {
//insert code here
}
Which fragment, inserted in the Books interface, enables the code to compile?
|
Option A | public abstract String type;
public abstract String getType();
|
Option B | public static String type;
public abstract String getType();
|
Option C | public String type = "Fiction";
public static String getType();
|
Option D | public String type = "Fiction";
public abstract String getType();
|
Correct Answer | D |
Explanation The blank final field type may not have been initialized
Question ID 21420 | Given:
interface Event {
String type = "Event";
public void details();
}
class Quiz {
static String type = "Quiz";
}
public class PracticeQuiz extends Quiz implements Event {
public void details() {
System.out.print(type);
}
public static void main(String[] args) {
new PracticeQuiz().details();
System.out.print(" " + type);
}
}
What is the result?
|
Option A | Event Quiz
|
Option B | Event Event
|
Option C | Quiz Quiz
|
Option D | Quiz Event
|
Option E | Compilation fails
|
Correct Answer | E |
Explanation Explanation: Compiler: Das Feld type ist mehrdeutig (ambiguous)