Java SE

Anonymous classes

Anonymous classes, such as listeners and adapters commonly used in user interfaces, do not have to be disposed. The GC will detect the circular reference and will dispose of the anonymous class automatically. 

button.addSelectionListener(new SelectionAdapter() {
 public void widgetSelected(SelectionEvent e) {
 // DO something here
 }
});

.

You must be logged in to post a comment.