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 = (1000).%(54)
// Displays output
println(result)
}
}
输出。
28
例如: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).%(17)
// Displays output
println(result)
}
}
输出。
-14