Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
object HelloWorld {
def main(args: Array[String]) {
println("Hello, world!")
var x: Int = 5
println("x is: "+x)
val p: Double = 3.14
println("p is "+p)
var a: Int = 4
var b:Int = 6
var result = add(a, b)
println(a+"+"+b+"="+result)
}
def add (x: Int, y: Int): Int = {
x+y
}
}