Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

protected class-compile error

 
Raja Narasimha
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Why I am getting compile error
 
Henry Wong
author
Marshal
Pie
Posts: 21000
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Isac paul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic