// Compiling this file demo.scala with // // scalac demo.scala // // produces a JVM byte-code program called demo.class // // Running the program with // // scala demo // // results in the string "Hello world" being sent to the standard output // // Running the program with // // scala demo Joe // // results in the string "Hello Joe" being sent to the standard output object demo { val greetings = "Hello world" def main(args : Array[String]) { println if (args.length == 0) printGreetings else println("Hello " + args(0)) println } def printGreetings { println(greetings) } }