|
|
Scala 2.3.3
|
abstract
trait
Application
extends java.lang.Object
with scala.ScalaObject
Application class can be used to quickly turn objects
into executable programs. Here is an example:
object Main extends Application {
Console.println("Hello World!")
}
Here, object Main inherits the main method
of Application. The body of the Main object
defines the main program. This technique does not work if the main
program depends on command-line arguments (which are not accessible
with the technique presented here).
It is possible to time the execution of objects that inherit from
class Application by setting the global scala.time property.
Here is an example for benchmarking object Main:
java -Dscala.time Main
| Val Summary | |
val
executionStart
: scala.Long
The time when execution of this program started. |
|
| Def Summary | |
def
main
(args: scala.Array[java.lang.String])
: scala.Unit
The default main method. |
|
| Val Detail |
| Def Detail |
def
main
(args: scala.Array[java.lang.String]): scala.Unit
args - the arguments passed to the main method