Open In App

Scala Int max() method with example

Last Updated : 30 Jan, 2020
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
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
// 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)
     
    }
} 
Output:
9
Example #2: Scala
// 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)
     
    }
} 
Output:
5

Next Article
Article Tags :

Similar Reads