Scala Short +(x: Int)方法及示例
利用+(x: Int)方法,可以找到所述Short值与Int类型的’x’之和。
方法定义: def +(x: Int):Int
返回类型。它返回Int。
例子:1#
// Scala program of +(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Int) method
val result = (113).+(10)
// Displays output
println(result)
}
}
输出。
123
例如:2#
// Scala program of +(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Int) method
val result = (1000).+(11)
// Displays output
println(result)
}
}
输出。
1011