READ Free Dumps For Oracle- 1z0-804
Question ID 21425 | Given the two Java classes:
class Word {
private Word(int length) {}
protected Word(String w) {}
}
public class Buzzword extends Word {
public Buzzword() {
// Line ***, add code here
}
public Buzzword(String s) {
super(s);
}
}
Which two code snippets, added independently at line ***, can make the Buzzword class compile?
|
Option A | this ();
|
Option B | this (100);
|
Option C | this ("Buzzword");
|
Option D | super ();
|
Option E | super (100);
|
Option F | super ("Buzzword");
|
Correct Answer | C,F |
Explanation
Question ID 21426 | Given:
public enum Direction {
NORTH, EAST, SOUTH, WEST
}
Which statement will iterate through Direction?
|
Option A | for (Direction d : Direction.values()){
//
}
|
Option B | for (Direction d : Direction.asList()){
//
}
|
Option C | for (Direction d : Direction.iterator()){
//
}
|
Option D | for (Direction d : Direction.asArray()){
//
}
|
Correct Answer | A |
Explanation Explanation: The static values() method of an enum type returns an array of the enum values. The foreach loop is a good way to go over all of them. //... Loop over all values. for (Direction d : Direction.values()){ System.out.println(d); // PrintsNORTH, EAST, ... }