score:5

Accepted answer

the main function needs to be inside an object, not a class definition. so instead of this

package main_function_test

class exm {
  def main(args: array[string]): unit = {
    println("hello world")
  }
}

write this:

package main_function_test

object exm {
  def main(args: array[string]): unit = {
    println("hello world")
  }
}

Related Query

More Query from same tag