Scala Int &(x: Byte)方法及示例

Scala Int &(x: Byte)方法及示例

该方法用于将byte值的按位AND操作的结果返回指定的int值。

方法定义:(Int_Value).&(byte_Value)

返回类型:返回byte值的按位AND操作的结果。

示例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 = (10).&(6)
          
        // Displays output
        println(result)
      
    }
} 
2

示例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 = (10).&(8)
          
        // Displays output
        println(result)
      
    }
} 
8

阅读更多:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程