Метод Scala Short max () с примером
Опубликовано: 12 Марта, 2022
Метод max () используется для нахождения максимума из двух указанных типов Short.
Method Definition: def max(that: Short): Short
Return Type: It returns the number of type Short with the maximum value.
Example: 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) } } |
Output:
999
Example: 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) } } |
Output:
1000