Scala Int &(x: Short)方法及示例
**& (x: Short) **方法用来返回短值对指定的int值进行位数和运算的结果。
方法定义:(Int_Value).&(short_Value)
返回类型。它返回短值对指定的int值进行位数和操作的结果。
例子 #1 :
// Scala program of Int &(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int &(x: short) function
val result = (10).&(6)
// Displays output
println(result)
}
}
输出。
2
例子#2
// Scala program of Int &(x: short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int &(x: short) function
val result = (10).&(8)
// Displays output
println(result)
}
}
输出。
8
极客教程