This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "protected class-compile error" Watch "protected class-compile error" New topic
Author

protected class-compile error

Raja Narasimha
Ranch Hand

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

Joined: Sep 28, 2004
Posts: 18756
    
  40

Similar to your other topic....

http://www.coderanch.com/t/518655/java-programmer-SCJP/certification/enum-cannot-private-or-protected


Top level protected classes are not allowed.

Henry


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

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: protected class-compile error