有人可以解释以下错误吗?非常感谢:))
Joe-iMac-2:Desktop joe$ groovy ExampleTest.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/joe/Desktop/ExampleTest.groovy: 2: unexpected token: in @ line 2, column 19.
print “Please key in a word: “
^
1 error
我的代码是:
String str
print “Please key in a word: “
str = System.console().readLine()
println “The word was: “ + str
print “Now please key in another: “
str = System.console().readLine()
print = “And this one was: “ + str
答案 0 :(得分:3)
似乎双引号是错误的,试试这个:
print "Please key in a word: "
用正确的引号替换程序中的所有引号。也许您使用错误的字体复制了文本中的代码?