Rewrite Java in Scala - companion object

The companion object basically provides a place where one can put "static-like" methods. Further more, a companion object, or companion module, has full access to the class members, including private ones.

Companion Objects are great for encapsulating things like factory methods. Instead of having to have Foo and FooFactory everywhere, you can have a class with a companion object take on the factory responsibilities.

Scala truly has nothing static.

One way in which Scala is more object-oriented than Java is that classes in Scala cannot have static members. Instead, Scala has singleton objects.