带有示例的 Scala Int shortValue() 方法
shortValue()方法用于返回指定值的短值。
Method Definition: def shortValue(): Byte
Return Type: It returns the short value of the given value.
示例 #1:
// Scala program of Int shortValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying shortValue method
val result = (15).shortValue
// Displays output
println(result)
}
}
输出:
15
示例 #2:
// Scala program of Int shortValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying shortValue method
val result = (1586).shortValue
// Displays output
println(result)
}
}
输出:
1586