Java class visibility

With regards to the following statement:
Normal (non-inner) classes cannot be made private or protected; they may only be given public or package access.

1)Is this because otherwise no other classes could be derived from it? Are there other reasons?

2) I thought "protected" meant only package access???
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>1)Is this because otherwise no other classes could be derived from it? Are there other reasons?

It's because they wouldn't be visible.

2. No - they're quite different:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kellyputtyAuthor Commented:
1. There is not point in making a non-inner class private. If there was a non-inner private class it means that the class can be used only by itself and none other. No use of a such an isolated self service class.

2. Protected means access within the package and also by sub-classes. Protected is primarily for inheritence. So it makes sense to have members of a class as protected not the class itself.

here is the accessor hierarchy in Java

Private - within the class
Package - within the package
Protected - within package and sub-classess
Public - every where
kellyputtyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.