Scala Int -(x: Long)方法及示例
利用 – ( x: Long) 方法,可以返回指定的int值和long值的差。
方法定义:(Int_Value).-(Long_Value)
返回类型。它返回指定的int值和long值的差值。
例子 #1 :
// Scala program of Int -(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int -(x: Long) function
val result = (100).-(50)
// Displays output
println(result)
}
}
输出。
50
例子#2
// Scala program of Int -(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int -(x: Long) function
val result = (10).-(5)
// Displays output
println(result)
}
}
输出。
5
极客教程