You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an object contains multiple methods named main, including one with a valid type signature for the "true" main method, the compiler issues a warning indicating that the object contains no such method.
scalac mains.scala
mains.scala:1:warning: TooManyMains has a main method with parameter typeArray[String], but TooManyMains will not be a runnable program.
Reason: main method must have exact signature (Array[String])UnitobjectTooManyMains {
^
one warning found
However it will will run successfully:
scala TooManyMainsHello, World!
The text was updated successfully, but these errors were encountered:
When an object contains multiple methods named main, including one with a valid type signature for the "true" main method, the compiler issues a warning indicating that the object contains no such method.
Here's an example:
However it will will run successfully:
The text was updated successfully, but these errors were encountered: