这本简单的教科书REPL有什么问题?
C:\Users\abc>scala
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> print "Hello"
<console>:1: error: ';' expected but string literal found.
print "Hello"
^
scala>
这应该打印&#34;你好&#34;
答案 0 :(得分:16)
如果你问得好,它确实有效:
scala> object please {
| val print = Predef.print _
| }
defined module please
scala> please print "Hello"
Hello
答案 1 :(得分:10)
使用正确的语法:
scala> print("Hello")
Hello