DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    What's up with protected access in JAVA?

    Can anybody explain to me why the protected access specifier allows all classes within a package to access the protected member variable instead of only allowing derived classes to access the protected member variable like in C++.

    Thanks a million,


  2. #2
    Join Date
    Dec 2004
    San Bernardino County, California
    The use of a package means that there is a relationship among the classes in the package. They are designed to work together, support each other, provide service to each other.

    It can be seen as providing "friend" functionality to Java.

    If you don't want to give classes this kind of access, make the method/field private, or don't create a package.

Similar Threads

  1. DevX does seem one sideded
    By Rob Abbe in forum Talk to the Editors
    Replies: 44
    Last Post: 01-13-2003, 02:57 PM
  2. how to access password protected database?
    By Sean in forum VB Classic
    Replies: 6
    Last Post: 07-23-2002, 08:04 PM
  3. Access 97 to 2000 Conversion Error
    By Michelle in forum VB Classic
    Replies: 8
    Last Post: 04-19-2002, 05:01 PM
  4. Replies: 0
    Last Post: 12-25-2000, 07:45 AM
  5. Replies: 0
    Last Post: 06-16-2000, 02:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.