That’s an anonymous inner class.
In the example above instead of creating a private class
that extends Button
we create an subclass of Button and provide the implementation of the overridden method in line with the rest of the code.
As this new class is created on the fly it has no name, hence anonymous. As it’s defined inside another class it’s an anonymous inner class.
It can be a very handy shortcut, especially for Listener
classes, but it can make your code hard to follow if you get carried away and the in line method definitions get too long.