The contents of myfile.scala
are as follows :
// println("print this line")
object myObj {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
If I run : scala myfile.scala
, it prints : Hello, world
If I uncomment the first println stmt, and run : scala myfile.scala
,
it only prints : print this line
,
and does not print hello-world stmt.
Why is this so? I find it very confusing. I tried to search the archives, but could not find any answers.