Classes in Java: Creating & Using Anonymous Classes

Java    |    Intermediate
  • 7 videos | 59m 45s
  • Includes Assessment
  • Earns a Badge
Rating 4.6 of 25 users Rating 4.6 of 25 users (25)
Anonymous classes in Java allow you to define code that use-and-throw. These are classes where you define and instantiate a class simultaneously and which are anonymous, i.e., do not have a name. These are perfect in scenarios where you want a class that implements a certain interface but will not be reused beyond where it is defined and accessed. Through this course, learn to create and use anonymous classes, recognizing how they are nested, inner, and unnamed classes that either implement an interface or derive from a base class. As you advance, explore some common use cases for anonymous classes. When you're finished with this course, you'll be able to create and use anonymous classes in Java correctly, with the correct syntax, and for the proper use case.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Define and use anonymous classes
    Recognize how anonymous instances are objects
    Illustrate the finer points of anonymous classes
  • Implement the built-in interfaces, comparator and runnable, with anonymous classes
    Perform filter operations with local and anonymous classes
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 3s
  • 10m 32s
  • Locked
    3.  Defining Why Anonymous Class Instances Are Objects
    9m 10s
  • Locked
    4.  Exploring Nuances of Anonymous Classes in Java
    10m 20s
  • Locked
    5.  Implementing Interfaces with Anonymous Classes in Java
    13m 2s
    In this video, you'll learn how to implement the built-in interfaces, Comparator and Runnable, with anonymous classes. You'll discover these single method interfaces have exactly 1 method for which you need to provide an implementation. These are often implemented using anonymous classes, which will be demonstrated here. Also, observe that we've printed out the contents of the list before sorting as well as after sorting. FREE ACCESS
  • Locked
    6.  Using Local and Anonymous Classes to Filter Data in Java
    13m 3s
    In this video, you'll learn how to make your code more compact, readable, and maintainable by using Lambda expressions. You'll begin with a simple scenario that doesn't use lambdas. Then you'll iteratively improve the solution until you get to using lambda expressions. FREE ACCESS
  • Locked
    7.  Course Summary
    1m 36s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 36 users Rating 4.5 of 36 users (36)
Rating 4.5 of 194 users Rating 4.5 of 194 users (194)
Rating 4.6 of 60 users Rating 4.6 of 60 users (60)