QUESTION 51
Given two files: GrizzlyBear.java and Salmon.java
1. package animals.mammals;
2.
3. public class GrizzlyBear extends Bear {
4. void hunt() {
5. Salmon s = findSalmon();
6. s.consume();
7. }
8. }
1. package animals.fish;
2.
3. public class Salmon extends Fish {
4. public void consume()
{ /* do stuff */ }
5. }
If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?
A. add import animals.mammals.*; at line 2 in Salmon.java
B. add import animals.fish.*; at line 2 in GrizzlyBear.java
C. add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
D. add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java
Solution : B
'자격증 > OCJP_ExamA' 카테고리의 다른 글
QUESTION 53 (0) | 2018.07.08 |
---|---|
QUESTION 52 (0) | 2018.07.08 |
QUESTION 50 (0) | 2018.07.08 |
QUESTION 49 (0) | 2018.07.08 |
QUESTION 48 (0) | 2018.07.08 |
#IT #먹방 #전자기기 #일상
#개발 #일상