In Scala you can’t declare class methods, all the methods defined in a class belong to the object.

class House(val street:String) {
  def clean() {
    println("Cleaning!")
  }
}

val h = new House("5th")
h.clean
// Cleaning!

If we want a class method so we can do something like House.cleanAll we have to declare a companion object, which is basically an object with the same name of a previously defined Class:

object House {
  def cleanAll() {
    println("Cleaning all!")
  }
}

House.cleanAll

And now we have the methods of the objects defined in the class and the “class methods” defined in the companion object, kind of tricky but this is how it works in Scala.