What are local classes good for?

Local class: Use it if you need to create more than one instance of a class, access its constructor, or introduce a new, named type (because, for example, you need to invoke additional methods later). Anonymous class: Use it if you need to declare fields or additional methods.

Sizin İçin Seçtik  Why do we create object in Java?

Leave a Reply

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