我知道这个文件夹在哪里,如何从终端运行hello.scala
我正在执行scala hello.scala
,它会生成错误
/Users/username/Desktop/hello/hello.scala:1: error: illegal start of definition
package org.scala
^
one error found
如何运行我的程序?
使用scala
命令时包括包名称,并根据类文件而不是源代码运行
scala org.scala.Hello
与Java一样,Scala命名约定表示类以类的首字母大写开头,例如Hello