{"id":3132,"date":"2016-02-10T00:57:18","date_gmt":"2016-02-10T00:57:18","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3132"},"modified":"2016-02-10T00:57:18","modified_gmt":"2016-02-10T00:57:18","slug":"scala-main","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/scala-main\/","title":{"rendered":"Scala main"},"content":{"rendered":"<p>Scala has a simple way of creating a &#8216;main&#8217; method:<\/p>\n<pre lang=\"scala\">\nobject HelloWorld { \n  def main(args: Array[String]) { \n    println(\"Hello, world!\")\n  } \n} \n<\/pre>\n<p>This will compile down to the &#8220;public static void main&#8221; that Java uses.<\/p>\n<p>Alternately, you can extend &#8220;App&#8221;:<\/p>\n<pre lang=\"scala\">\nobject HelloWorld extends App {\n  println(\"Hello World\")\n}\n<\/pre>\n<p>Note that the &#8220;main&#8221; part is done for you.<\/p>\n<p>Also you <i>must<\/i> compile this, and not run it through the interpreter. I.e.:<\/p>\n<pre lang=\"bash\">\nscalac hello.scala\nscala Hello\nHello World!\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Scala has a simple way of creating a &#8216;main&#8217; method: object HelloWorld { def main(args: Array[String]) { println(&#8220;Hello, world!&#8221;) } } This will compile down to the &#8220;public static void main&#8221; that Java uses. Alternately, you can extend &#8220;App&#8221;: object HelloWorld extends App { println(&#8220;Hello World&#8221;) } Note that the &#8220;main&#8221; part is done for &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/scala-main\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Scala main&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[480,485],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3132"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3132"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3132\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}