I'm a beginner in scala, without java background. I don't understand the import system. I have my application, where i use the import
import Array._
import List._
import Controller.api
object scalaStart{
def main(args: Array[String]){
var apiCtrl = new api()
apiCtrl.getById(1)
println(apiCtrl.title)
}
}
And this is the class:
package Controller
class api {
var id:Int
var title:String
var description:String
def getById(id:Int){
if(id = 1){
this.id = 1
this.title = s"Title Nummer ${this.id}"
this.description = s"Description Nummer ${this.id}"
}else{
this.id = 1
this.title = s"Artikel mit der ID: ${this.id} existiert nicht."
this.description = s"Kein Eintrag mit der ID: ${this.id}"
}
}
}
i checked also only import api and import controller and wildcards controller._ controller.api._.