Scala introduces a new object keyword, which is used to represent Singleton classes. These are the class with just one instance and their method can be thought of as similar to Java's static methods.
Here is a Singleton class in Scala:
def sum(l: List[Int]): Int = l.sum
This sum method is available globally, and can be referred to, or imported, as the test.Singleton.sum. A singleton object in Scala can also extend classes and traits.
Hope this helps!
If you need to know more about Scala, join Apache Spark course today and become the expert.