In Scala, Long is a 64-bit signed integer, which is equivalent to Java’s long primitive type. The !=(x: Byte) method is utilized to check whether the given Long and Byte value are equal to each other or not.
Method Definition – def !=(x: Byte): Boolean
Returns – Returns true if this value is not equal to x, false otherwise.
Example #1:
// Scala program to explain working // of Long !=(x: Byte) function // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying !=(x: Byte) function
val result = (- 128 ).toLong.! = (- 2 ^ 7 : Byte)
// Displays output
println(result)
}
} |
Output:
true
Example #2:
// Scala program to explain working // of Long !=(x: Byte) function // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying !=(x: Byte) function
val result = 16 .toLong.! = ( 2 ^ 4 : Byte)
// Displays output
println(result)
}
} |
Output:
true
Article Tags :