Scala short /(x: Byte):Int

Scala short /(x: Byte):Int

Short,一个16位有符号的整数(相当于Java的short原始类型)是scala.AnyVal的一个子类型。利用/(x: Byte)方法来返回x对指定Byte值进行商运算的结果。

方法定义:def /(x: Byte):Int

返回类型。它返回值和x的商。

例子 #1:

// Scala program of Short /(x: Byte) 
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Short /(x: Byte) function 
        val result = (998.toShort)./(20:Byte)
          
        // Displays output 
        println(result) 
      
    } 
} 

输出。

49

例子#2。

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

输出。

-2

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程