aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question in K&B Book - protected class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question in K&B Book - protected class" Watch "Question in K&B Book - protected class" New topic
Author

Question in K&B Book - protected class

mustafa duran
Greenhorn

Joined: Oct 10, 2005
Posts: 14
Hi friends,

the following question comes from K&B SCJP 1.4 book on Chapter 2. I am confused about "protected class" term. Can protected modifier be used for classes? if so what is the reason?

Question No 2 :
Given a method in a protected class, what access modifier do you use to restrict access to
that method to only the other members of the same class?
A. final
B. static
C. private
D. protected
E. volatile
F. default access
Kris Krason
Greenhorn

Joined: Aug 05, 2005
Posts: 25
Well, it is possible if it is an inner class.


Kris Krason<br />SCJP1.4 (96%)<br />SCJP1.5 (91%)<br /> <br />See my <a href="http://krisreviews.com/2006/12/code-complete-second-edition/" target="_blank" rel="nofollow">Code Complete review</a><br /> <br /><a href="http://www.coderookie.com/2006/tutorial/the-pseudocode-programming-process/" target="_blank" rel="nofollow">Pseudocode Programming Process</a>
david lightman
Ranch Hand

Joined: Nov 03, 2004
Posts: 82
C.Private

I thought Classes use default and public,
Members can use all four, public private, protected and default.
[ November 10, 2005: Message edited by: david lightman ]
Patrick Williams
Ranch Hand

Joined: Apr 03, 2005
Posts: 213
I'm not sure if it was captured in the errata and republished, but my copy of K&B states "Given a method in a public class, what access modifier..."
[ November 13, 2005: Message edited by: Patrick Williams ]

Patrick<br /> <br />SCJP/SCWCD/SCBCD/SCDJWS/SCEA<br /> <br />Currently working on:<br />SCJP 6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question in K&B Book - protected class
 
Similar Threads
protected access modifier
basic question on access modifiers and levels
Constructors and interfaces
import vs extend?
Question on Access Modifiers