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 = (10).&(6)
// Displays output
println(result)
}
}
输出。
2
例子#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).&(8)
// Displays output
println(result)
}
}
输出。
8
极客教程