带有示例的 Scala Char max() 方法
max()方法用于查找两个指定字符中的最大值。
Method Definition: def max(that: Char): Char
Return Type: It returns the character 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 = ('F').max('A')
// Displays output
println(result)
}
}
输出:
F
示例:2#
// Scala program of max()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying max() method
val result = ('a').max('A')
// Displays output
println(result)
}
}
输出:
a