scala Byte -(x: Long): Long

scala Byte -(x: Long): Long

在Scala中,Byte是一个8位有符号整数(等同于Java的byte原始类型)。 -(x:Long)方法用于返回此值与x的差异

方法定义: Byte -(x: Long): Long
返回类型: 它返回此值与x的差异。

示例1:

// Scala program of Byte -(x: Long)
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte -(x: Long) function 
        val result = (167.toByte).-(125:Long) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

-213

示例2:

// Scala program of Byte -(x: Long)
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte -(x: Long) function 
        val result = (128.toByte).-(2:Long) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

-130

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

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程