Open In App

Scala Short max() method with example

Last Updated : 11 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The max() method is utilized to find the maximum of the two specified Short types.

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads