Scala Int >>(x: Byte) 方法及示例
使用 > >(x: Byte)方法将int值向右移位指定的字节数,并返回结果。
方法定义:(Int-Value).>>(Byte_Value)
返回类型:返回的值是int值向右移位指定的字节数的结果。
示例1:
// Scala program of Int >>(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int >>(x: Byte) function
val result = (15).>>(2)
// Displays output
println(result)
}
}
3
示例2:
// Scala program of Int >>(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int >>(x: Byte) function
val result = (15).>>(3)
// Displays output
println(result)
}
}
1
阅读更多:Scala 教程
极客教程