How do you initialize an anonymous class in Java?

You can use the instance initialization section: new AbstractAction() { { //initialization code goes here } actionPerformed(ActionEvent event) { … } } Show activity on this post. Or you can just access the variables of the outer class from the inner class.

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 *