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 is the difference between an inner class and a static nested class?

Leave a Reply

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