Scala contains a trait called “App” and its used to turn objects into executable programs.
We do not need to explicitly define “main” method in a Scala object, instead the whole class body becomes the main method.
Refer the below example,
In the above code, we define an object “ScalaMain” and in the body of that object, we define a function “add” for adding two numbers. The whole code section becomes the main method.