자격증/OCJP_ExamB
QUESTION 20
IT grow.
2018. 7. 9. 21:14
반응형
QUESTION 20
Given:
class One {
void foo() { }
}
class Two extends One{
14. // insert method here }
Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)
A. int foo() { /* more code here */ }
B. void foo() { /* more code here */ }
C. public void foo() { /* more code here */ }
D. private void foo() { /* more code here */ }
E. protected void foo() { /* more code here */ }
Solution : BCE
plus imformation
protected in java ??
-- >
접근제어자가 protected로 설정되었다면 protected가 붙은 변수, 메소드는 동일 패키지내의 클래스 또는 해당 클래스를 상속받은 외부 패키지의 클래스에서 접근이 가능하다.
반응형