Java 11 Cookbook
上QQ阅读APP看书,第一时间看更新

Fast Track to OOP - Classes and Interfaces

In this chapter, we will cover the following recipes:

  • Implementing Object-Oriented Design (OOD)
  • Using inner classes
  • Using inheritance and aggregation
  • Coding to an interface
  • Creating interfaces with default and static methods
  • Creating interfaces with private methods
  • A better way to work with nulls using Optional
  • Using the utility class Objects

The recipes in this chapter do not require any prior knowledge of OOD. However, some experience of writing code in Java would be beneficial. The code samples in this chapter are fully functional and compatible with Java 11. For better understanding, we recommend that you try to run the presented examples.

We also encourage you to adapt the tips and recommendations in this chapter to your needs in the context of your team experience. Consider sharing your newfound knowledge with your colleagues and discuss how the described principles can be applied to your domain and your current project.