Scala Hello World

Put this code into a file with a .scala extension.

object NewYear {
    def main(args: Array[String]) {
        println("Happy New Year! :-)")

Compile and run:

mmahmood@ubuntu:~$ scalac NewYear.scala
mmahmood@ubuntu:~$ scala NewYear

Another method of compilation is to use fsc command (Fast Scala Compiler). It's really fast as it called, it use compilation daemon which cached during first compilation and reuse it in the subsequent runs.

fsc NewYear.scala


Happy New Year! :-)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License