Why are inner classes discouraged in Java?

Non-static inner classes can hide a performance problem . They do have access to member fields on the enclosing class, but not directly, but via getters which are created automatically. This will be slower then just copying the members of the enclosing class to the inner class.

Sizin İçin Seçtik  What is inner classes in OOP?

Leave a Reply

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