带有示例的 Scala Short max() 方法
max()方法用于查找两个指定的 Short 类型的最大值。
Method Definition: def max(that: Short): Short
Return Type: It returns the number of type Short with the maximum value.
示例:1#
// Scala program of max()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying max() method
val result = (-1000).max(999)
// Displays output
println(result)
}
}
输出:
999
示例:2#
// Scala program of max()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying max() method
val result = (990).max(1000)
// Displays output
println(result)
}
}
输出:
1000