File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 20521

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: 446

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%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
I agree. Here's the link:
subject: protected class-compile error
It's not a secret anymore!