Scala, importing class

  • logic.scala code
package logic

class Logic{

  def hello = "hello"

}
  • main.scala code
package runtime

import logic.Logic  // import

object Main extends Application{

  println(new Logic hello) // instantiation and invocation

}
  • compile the files with scalac
scalac *.scala
  • run your application with scala
scala -cp . runtime.Main

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)