How to call main method of a Scala program from the main method of a java program? -


suppose have scala class , java class in java project , scala class below

class sam {    def main(args: array[string]): unit = {     println("hello")   }  } 

how can call it's main method main method of java program present in same project

typically, main methods static in java, , in object in scala. allows run them command line. code defines class, not object.

i'd suggest changing scala code to:

object sam {   def main(args: array[string]): unit = {     println("hello")   } } 

you can call java main method follows:

class foo  {     public static void main(string[] args) {         sam.main(args);     } } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -