File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Request to Barry Gaunt and Bert Bates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Request to Barry Gaunt and Bert Bates" Watch "Request to Barry Gaunt and Bert Bates" New topic
Author

Request to Barry Gaunt and Bert Bates

Sac Anand
Greenhorn

Joined: Apr 21, 2006
Posts: 19
Hello Barry / Bert

Request you to please look at the below mentioned thread:

Doubt in K&B SCJP 5: protected access

As mentioned in the aforementioned thread initiated by Peter Schubert, i strongly support Peter.

K&B - page 36 says
The bottom line: when a subclass-outside-the-package inherits a protected member, the member is essentially private inside the subclass, such that only the subclass and its subclasses can access it.


An exception to the bold portion above is, any class, in the same package of Parent class, can access the inherited protected variable of subclass-outside-the-package without using inheritance.

To support the above statement, Peter has given an excellent example in the abobe mentioned thread.

Best Regards,
Sachin Anand
Alangudi Balaji Navaneethan
Ranch Hand

Joined: Apr 28, 2004
Posts: 42
Hi,

What they have written is correct. It should be understood that inside the package where the subclass is, only the subclass and the subclasses of it are able to access the protected member which has been declared in any outer subclass as protected...


if you think you can you r right<br />if you think you can not you r double right
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
[Kathy here, answering the question under Bert's log-in]

I agree with Peter. Sachin, thanks for bringing this up again... I responded in the original thread, but in a nutshell--Peter's correction (and suggestion for improving the wording) is absolutely right!

Cheers,
Kathy


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Sac Anand
Greenhorn

Joined: Apr 21, 2006
Posts: 19
Thanks a lot Kathy

Regards,
Sachin Anand
Alangudi Balaji Navaneethan
Ranch Hand

Joined: Apr 28, 2004
Posts: 42
Hi Kethy,

If so what Have I said is correct?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request to Barry Gaunt and Bert Bates