Better companions

Companion objects are an effective way to scope properties and methods to an enclosing class and to mimic the behavior of static properties and methods from Java. Unfortunately, the syntax for working with companion objects can be cumbersome when used from Java. In this section, we'll take a look at how to work effectively with companion objects.