| Author |
doubt on uCertify question
|
zhong chen
Greenhorn
Joined: Oct 12, 2009
Posts: 24
|
|
Question is: Which of the following statements is true:
A: Encapsulation breaks due to both int i and string name.
B: Encapsulation breaks due to int i.
C: Encapsulation breaks due to string name.
D: Encapsulation breaks due to int j
E: The class is fully Encapsulated.
The answer is A.
I think protected instance variable should be considered as proper encapsulation so the answer should be C. Am I right?
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6603
|
|
|
A class that extends this class should be able to access the internal variable. You can consider that as an information leak from this class, which should justify the answer
|
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
|
 |
Atwal Usha
Ranch Hand
Joined: Sep 10, 2009
Posts: 137
|
|
|
Encapsulation is broken if by any means the internal data of a class could be directly modified. Protected access modifier could also be considered as a cause of it.
|
Java Certification Exam Mock Tests: SCJA SCJP 5 SCJP 6 SCJP 6 (Online Training) SCJP 6 (Instructor Led Training) SCWCD 5 SCBCD 5 SCEA 5
|
 |
 |
|
|
subject: doubt on uCertify question
|
|
|