This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes protected class-compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "protected class-compile error" Watch "protected class-compile error" New topic

protected class-compile error

Raja Narasimha
Ranch Hand

Joined: Nov 28, 2010
Posts: 33
Hi, Why I am getting compile error
Henry Wong

Joined: Sep 28, 2004
Posts: 18544

Similar to your other topic....

Top level protected classes are not allowed.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Isac paul

Joined: Dec 06, 2007
Posts: 6
First of all, The access modifiers protected and private are not applicable for Class.
So, Why you want to create class which is having protected access ???
What is the purpose of writing a class ???

Please read more on access modifiers and non-access modifiers.

You can protect only your members ( Instance Variables or methods ) by using protected keyword ..

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

Isac paul wrote:First of all, The access modifiers protected and private are not applicable for Class.

actually I want to correct this a little bit
we can write a protected INNER class but NOT the outer class

outer class can be only public and default

have a nice time

SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: protected class-compile error
Similar Threads
access violation with a protected
Java Puzzle for You
bout top-level class
acc ss modifier in array declarations
modifiers for top-level class?