Scala short /(x: Long): Long

Scala short /(x: Long): Long

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

方法定义:def /(x: Long):Long

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

例子 #1:

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

输出。

49

例子#2。

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

输出。

-2

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程