Groovy多行字符串有什麼問題? - What's wrong with Groovy multi-line String?

問題:

Groovy scripts raises an error: Groovy腳本引發錯誤:

def a = "test"
  + "test"
  + "test"

Error: 錯誤:

No signature of method: java.lang.String.positive() is 
applicable for argument types: () values: []

While this script works fine: 儘管此腳本可以正常工作:

def a = new String(
  "test"
  + "test"
  + "test"
)

Why? 爲什麼?


解決方案:

參考: https://stackoom.com/en/question/LJUD
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章