'Simple Scala program not executing on command prompt [closed]

This is some of the strange issue, the program is only printing hello scala, but it seems that I am getting syntax weird error. Please correct me if I miss anything

Program

 object hello{
     def main(args:Array[String]){
            println("Hello Scala")
        }
    }

Error:- '=' expected, but '{' found



Solution 1:[1]

As the error message suggests, you need a = before the {:

def main(args: Array[String]) = {
  println("Hello Scala")
}

The syntax you used was originally supported so you might see it in some example code. But it was deprecated in later versions and is now no longer allowed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1