Scala Char %(x: Byte) 方法及示例
%(x: Byte) 方法用于查找所述字符值除以类型为 Byte 的 ‘x’ 的余数。
方法定义:def %(x: Byte): Int
返回类型:返回 Int 类型。
示例1:#1
// Scala program of %(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying %(x: Byte) method
val result = 'E'.%(111)
// Displays output
println(result)
}
}
69
示例2:#2
// Scala program of %(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying %(x: Byte) method
val result = 'B'.%(-116)
// Displays output
println(result)
}
}
66
更多Scala相关文章,请阅读:Scala 教程
极客教程