In this course, you will focus on one of the most important concepts in all object-oriented programming for Java, the interface. Learners explore how anonymous inner classes provide lightweight instantiations of interfaces, and how interfaces are pure abstract entities. Begin with an introduction into using interfaces and how all their methods are abstract by default. Examine how the instanceof operator works the same way with interfaces as with classes. This leads on to combining the extends and implements keywords: implementing a derived class that can extend a base class and implement an interface. Then learners learn to set up two inheritance hierarchies and combine these into a set of objects that implement both sets of interfaces. Advanced features of interfaces are also examined. Learn how interfaces can support default method implementations. You will set up a class that implements some of the methods of an interface and declares itself abstract. Finally, you will create and define anonymous inner class objects and access outer class variables from your anonymous inner class.
Objectives |
---|
Java OOP: Interfaces & Anonymous Classes
|
