• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question in K&B Book - protected class

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it is possible if it is an inner class.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic