Difference between using App trait and main method in scala

后端 未结 3 1026
清酒与你
清酒与你 2020-11-28 21:55

What is the difference between

object Application extends App {
   println(\"Hello World\")
}

and

object Application {
           


        
3条回答
  •  被撕碎了的回忆
    2020-11-28 22:37

    App trait is implemented using the [[DelayedInit]] functionality, which means that fields of the object will not have been initialized before the main method has been executed.

提交回复
热议问题