Scala Int +(x: String)方法及例子
+ (x: String) 方法用于返回指定的int值和字符串值的总和。
方法定义:(Int_Value).+(String_Value)
返回类型:返回指定的int值和字符串值的总和。
例子1:
// Scala program of Int +(x: String)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int +(x: String) function
val result = (100).+("GFG")
// Displays output
println(result)
}
}
100GFG
例子2:
// Scala program of Int +(x: String)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int +(x: String) function
val result = (110).+("GEEKS")
// Displays output
println(result)
}
}
110GEEKS
阅读更多:Scala 教程
极客教程