954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Inner class

Is it necessary to declare an inner class private?If it is then plz specify the reason why is it necessary to declare an inner class private?

Parsu7
Light Poster
29 posts since Feb 2008
Reputation Points: 9
Solved Threads: 1
 

an inner class can have any modifier (eg public, private etc)
http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html

majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
 

> Is it necessary to declare an inner class private?

No. Here is some information which you would find useful when learning about Inner Classes.

EDIT: Too slow.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

An inner class is nothing but a member of its enclosing class. Any member of class can be declated with access modifiers like public, private, protected.
Access modifiers make the member to be visible to others or not

madhusamala
Newbie Poster
8 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

though depending on what you want to use it for it may or may not require the static attribute.
That's the only one that in some cases is dictated.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You