Scala 範例程式 - 不定個數的參數 (varargs)


/** Using Java varargs */
object varargs extends Application {
  val msg = java.text.MessageFormat.format(
    "At {1,time} on {1,date}, there was {2} on planet {0}.",
    "Hoth", new java.util.Date(), "a disturbance in the Force")


D:\Scala\code>scalac varargs.scala

D:\Scala\code>scala varargs
Message=At 下午 01:46:18 on 2009/10/15, there was a disturbance in the Force on
planet Hoth.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License