Object Literals In Java?

java

Solution

This is an anonymous inner class.

In this case, the code is declaring an unnamed class which implements the `ClickHandler` interface. When run, an instance of the class will be created and passed to `addClickHandler`.

Problem

I am learning GWT for web development and came across a piece of code I can't really understand. ``` helloBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("Hello!"); } }); ``` If someone could explain to me what it is doing that would be great. Thanks, John

Original source