Scala Byte ==(x: Long): Boolean

Scala Byte ==(x: Long): Boolean

在Scala中,Byte是一个8位有符号整数(相当于Java的byte原始类型)。方法 ==(x:Long) 用于在该值等于x时返回true,否则返回false。

方法定义: Byte ==(x: Long): Boolean
返回类型: 如果该值等于x,则返回true,否则返回false。

例子#1:

// Byte ==(x: Long)方法的Scala程序
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte ==(x: Long) function 
        val result = (64.toByte).==(64:Long) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

true

例子#2:

// Byte ==(x: Long)方法的Scala程序
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte ==(x: Long) function 
        val result = (25.toByte).==(111:Long) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

false

更多Scala相关文章,请阅读:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程