the code below:
object Statistic{
def main(args:Array[String]):Unit={}
}
will report error "main method should be static"
but if object name is not "Statistic" like below,no error reported:
object Statistics{
def main(args:Array[String]):Unit={}
}
and i'm using IDEA for Scala
The problem is with Intellij run configurations. Sometimes it fails to adapt to changes in the code. Just delete the run configuration that creates the problem and you will see it works also with Statistic
.
Its an IntelliJ quirk. In run configuration remove the dot in front of the main class. You can find it in: Run -> Edit Configurations... -> Main class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With