Sitemap
The Java Report

A curation of contemporary content on all things Java, JavaFX, JavaEE, and JVM technologies.

Member-only story

How Java 10 changes the way we use Anonymous Inner Classes

--

Source:

When a new feature is introduced to a programming language specification, language designers typically look out for conflicts with existing language features, breaking changes, bugs, & any situation that can lead to undefined or unintended behavior.

Often enough, however, subtle changes in the new, practical ways we can now write code from version to version go without much notice. These changes are often the side-effects of a new addition to a programming language specification. These sorts of changes, are not, strictly speaking, new language features. However, they are subtle changes brought on by the advent of a feature or combination of features.

Anonymous Inner Classes

In Java, inner classes are classes defined as a member of a class. They may take one of four forms (anonymous, static, method-local, or instance member).

Anonymous inner classes are unnamed classes which provide an implementation of an existing class. Typically, this finds common practical use in event-driven programming for the handling of events. Usually, the anonymous inner class provides a concrete implementation for an abstract class, on the fly. This is, however, not required; Anonymous inner classes may be made from concrete classes.

The Java Report
The Java Report

Published in The Java Report

A curation of contemporary content on all things Java, JavaFX, JavaEE, and JVM technologies.

Adrian D. Finlay
Adrian D. Finlay

Written by Adrian D. Finlay

@thewiprogrammer. Lover of learning, programming. Tech writer, Java aficionado. Proud mango, fishing, NBA addict! & more. Network w/ me @

Responses (8)