Open In App

Scala short &(x: long): Long

Short, a 16-bit signed integer (equivalent to Java’s short primitive type) is a subtype of scala.AnyVal. The &(x: Long) method is utilized to return a result of the bitwise AND operation on the specified long value by the long value.

Method Definition: def +(x: Long): Long



Return Type: It returns Long.

Example #1:




// Scala program of Short &(x: Long) 
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying Long &(x: Long) function 
        val result = (998).&(100000L)
          
        // Displays output 
        println(result) 
      
    

Output:



672

Example #2:




// Scala program of Short &(x: Long) 
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying Long &(x: Long) function 
        val result = (111).&(-100000L) 
          
        // Displays output 
        println(result) 
      
    

Output:

96

Article Tags :