Why can’t inner classes have static members?

The reason why inner classes cannot have static members is because static members are usually instantiated when the program starts . However, an inner class depends on having an instance of its enclosing class in order to create it and then access it’s members.

Sizin İçin Seçtik  What is constructor and anonymous inner class instance?

Leave a Reply

Your email address will not be published. Required fields are marked *