QUESTION 6자격증/OCJP_ExamC2018. 7. 21. 16:19
Table of Contents
반응형
QUESTION 6Given:1.2. public class Hi {3. void m1() { }4. protected void m2() { }5. }6. class Lois extends Hi {7. // insert code here8. }Which four code fragments, inserted independently at line 7, will compile? (Choose four.)A. public void m1() { }B. protected void m1() { }C. private void m1() { }D. void m2() { }E. public void m2() { }F. protected void m2() { }G. private void m2() { }Solution : ABEF
plus imformation
C. Main.java:7: m1() in Lois cannot override m1() in Hi;
attempting to assign weaker access privileges;
was package private void m1() { }
^ 1 error
D. Main.java:7: m2() in Lois cannot override m2() in Hi;
attempting to assign weaker access privileges;
was protected void m2() { }
^ 1 error
G. Main.java:7: m2() in Lois cannot override m2() in Hi;
attempting to assign weaker access privileges;
was protected private void m2() { }
^ 1 error
반응형
'자격증 > OCJP_ExamC' 카테고리의 다른 글
QUESTION 8 (0) | 2018.07.21 |
---|---|
QUESTION 7 (0) | 2018.07.21 |
QUESTION 5 (0) | 2018.07.21 |
QUESTION 4 (0) | 2018.07.20 |
QUESTION 3 (0) | 2018.07.20 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상