title: NoSuchMethodException upon launching Scala program
body: <p>So I just started learning Scala this afternoon and quickly came to a stopping point with such exception when trying to run my program with standard <code>scalac Sqrt.scala</code> and <code>scala Sqrt</code>:</p>
  
  <pre><code>java.lang.NoSuchMethodException: Sqrt.main is not static
      at scala.reflect.internal.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:68)
      at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
      at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:22)
      at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:39)
      at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:29)
      at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:39)
      at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:65)
      at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
      at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
      at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
      at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
  </code></pre>
  
  <p>Here's the code of my Sqrt.scala:</p>
  
  <pre><code>class Sqrt {
    val PRECISION = 0.01
  
    def abs(d: Double): Double =
      if (d &gt;= 0) d else -d
  
    def isCloseEnough(guess: Double, x: Double): Boolean =
      abs(guess * guess - x) &lt; PRECISION
  
    def improve(guess: Double, x: Double): Double =
      (x/guess + guess)/2
  
    def iter(guess: Double, x: Double): Double =
      if(isCloseEnough(guess, x)) guess
      else iter(improve(guess, x), x)
  
    def sqrt(x: Double): Double =
      iter(1, x)
  
    def main(args: Array[String]) {
      println(sqrt(16))
    }
  }
  </code></pre>
  
  <p>Can anyone come up with an explanation?</p>