This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Private Accessibility

 
Phillipe Rodrigues
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Request more explanation on the "Private" accessibility modifier with reference to below example:Why I should get the below error?






Output:

---------- Compile ----------
Sub_class.java:1: modifier private not allowed here
private class Sub_class extends Super_class

1 error

Output completed (1 sec consumed) - Normal Termination
 
Shiva Kumar Shedad
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all a class cannot be made as private whether it extends another class or not...
Because it doesnot make sense...

Originally posted by Phillipe Rodrigues:
Request more explanation on the "Private" accessibility modifier with reference to below example:Why I should get the below error?






Output:

---------- Compile ----------
Sub_class.java:1: modifier private not allowed here
private class Sub_class extends Super_class

1 error

Output completed (1 sec consumed) - Normal Termination
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes can actually be private, but I have only seen that inside other classes. If a class isn't inside another class, private access would mean it would be inaccessible to any code from anywhere.
 
Shiva Kumar Shedad
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Classes can actually be private, but I have only seen that inside other classes. If a class isn't inside another class, private access would mean it would be inaccessible to any code from anywhere.


Thanks Ritchie. I had forgotten about the inner classes while replying.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic