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?

Recommended Answers

All 4 Replies

> 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.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.