The max() method is utilized to return the maximum value of the two specified int numbers.
Method Definition: (First_Number).max(Second_Number)
Return Type: It returns true the maximum value of the two specified int numbers.
Example #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) } } |
chevron_right
filter_none
Output:
9
Example #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) } } |
chevron_right
filter_none
Output:
5
Recommended Posts:
- Scala | map() method
- Scala Int ==(x: Int) method with example
- Scala Int !=(x: Int) method with example
- Scala Set contains() method with example
- Scala Set +() method with example
- Scala Set -() method with example
- Scala Int >>(x: Int) method with example
- Scala Int self() method with example
- Scala Int min() method with example
- Scala Set take() method with example
- Scala Int abs() method with example
- Scala Map min() method with example
- Scala Int %(x: Int) method with example
- Scala Set &~() method with example
- Scala Map max() method with example
- Scala Int /(x: Int) method with example
- Scala Int ^(x: Int) method with example
- Scala Int | (x: Int) method with example
- Scala map contains() method with example
- Scala Set &() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

