Why do we need inner class can’t we just work with outer classes wherever we implement inner classes?

Making Address and City as outer class exposes City to any of the Class . Making it an inner class of Address will make sure that its accessed using object of Address.

Sizin İçin Seçtik  What do you mean by anonymous inner class in Java?

Leave a Reply

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