Skip to content
Related Articles

Related Articles

Scala short &(x: long): Long
  • Last Updated : 05 Dec, 2019

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :