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

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -

python - How to create a legend for 3D bar in matplotlib? -