最佳答案
考虑下面的代码:
private def test(some:String*){
}
private def call () {
val some = Array("asd", "zxc")
test(some)
}
它打印 expect String, found Array[String]
为什么? Scala 变量不是数组吗?
注意
我在 Stack Overflow 上发现了一些关于 Scala varargs 的问题,但是它们都是关于调用 Java varargs 方法或者关于将 Scala 列表转换为数组的。