scala,import test._ ; import test.{ClassA,ClassB}

在scala中,*不是通配符,下斜杠“_”才是通配符。因此当使用某个package所有的类时,直接使用:import test._;使用某几个时,直接使用:import test.{ClassA,ClassB}

  • Do you want to use the whole package? Use import me.test._.
  • Do you want to cherry-pick only some parts of the package? Use import me.test.{ ClassOne, classTwo }.

参考:https://softwareengineering.stackexchange.com/questions/194686/why-does-scala-use-the-operator-for-package-import-instead-of-as-in-java

原文地址:https://www.cnblogs.com/shengulong/p/9325822.html