Skip to content
Related Articles
Open in App
Not now

Related Articles

Scala Long !=(x: Long) method with example

Improve Article
Save Article
  • Last Updated : 02 Nov, 2019
Improve Article
Save Article

In Scala, Long is a 64-bit signed integer, which is equivalent to Java’s long primitive type. The !=(x: Long) method is utilized to check whether the given Long value is equal to each other or not.

Method Definition – def !=(x: Long): Boolean

Returns – Returns true if this value is not equal to x, false otherwise.

Example #1:




// Scala program to explain working 
// of Long !=(x: Long) function
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying !=(x: Long) function
        val result = (10).toLong.!= (10)
          
        // Displays output
        println(result)
      
    }

Output:

false

 

Example #2:




// Scala program to explain working
// of Long !=(x: Long) function
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying !=(x: Long) function
        val result = 1186000000.toLong.!= (129600000)
          
        // Displays output
        println(result)
      
    }

Output:

true

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!