QUESTION 4자격증/OCJP_ExamD2018. 7. 26. 20:03
Table of Contents
반응형
QUESTION 4Given:1. public class Plant {2. private String name;3.4. public Plant(String name) {5. this.name = name;6. }7.8. public String getName() {9. return name;10. }11. }1. public class Tree extends Plant {2. public void growFruit() {3. }4.5. public void dropLeaves() {6. }7. }Which statement is true?A. The code will compile without changes.B. The code will compile if public Tree() { Plant(); } is added to the Tree class.C. The code will compile if public Plant() { Tree(); } is added to the Plant class.D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.Solution : D
반응형
'자격증 > OCJP_ExamD' 카테고리의 다른 글
QUESTION 6 (0) | 2018.07.29 |
---|---|
QUESTION 5 (0) | 2018.07.29 |
QUESTION 3 (0) | 2018.07.26 |
QUESTION 2 (0) | 2018.07.26 |
QUESTION 1 (0) | 2018.07.26 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상