Scala Int max() 方法与示例
max()方法用于返回两个指定 int 数的最大值。
Method Definition: (First_Number).max(Second_Number)
Return Type: It returns true the maximum value of the two specified int numbers.
示例 #1:
// Scala program of Int max()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying max method
val result = (5).max(9)
// Displays output
println(result)
}
}
输出:
9
示例 #2:
// Scala program of Int max()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying max method
val result = (5).max(5)
// Displays output
println(result)
}
}
输出:
5