对于那些想快速阅读的人来说,这是一个小例子 object ApplyExample01 extends App { class Greeter1(var message: String) { println("A greeter-1 is being instantiated with message " + message) } class Greeter2 { def apply(message: String) = { println("A greeter-2 is being instantiated with message " + message) } } val g1: Greeter1 = new Greeter1("hello") val g2: Greeter2 = new Greeter2() g2("world")} 输出greeter-1正在使用消息hello实例化greeter-2正在用消息世界实例化