O'Reilly logo

Java All-in-One For Dummies, 4th Edition by Doug Lowe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7

Using Inner Classes, Anonymous Classes, and Lambda Expressions

In This Chapter

arrow Using inner classes

arrow Creating static inner classes

arrow Implementing anonymous classes

arrow Adding Lambda expressions

In this chapter, you find out how to use three advanced types of classes: inner classes, static inner classes, and anonymous inner classes. All three types are useful in certain circumstances. In particular, inner classes and anonymous inner classes are commonly used with graphical applications created with Swing. For more information about Swing, refer to Book VI. In this chapter, I concentrate on the mechanics of creating these types of classes.

warning.eps You'll also learn about a new feature of Java 8 called lambda expressions, which simplify the task of creating and using anonymous classes.

technicalstuff.eps Once again, this chapter could have a Technical Stuff icon pasted next to every other paragraph. The immediate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required