Skip to content
Related Articles

Related Articles

Scala Float max() method with example

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Oct, 2019
View Discussion
Improve Article
Save Article

The max() method is utilized to return the maximum value of the two specified float numbers.

Method Definition: (First_Number).max(Second_Number)

Return Type: It returns the maximum value of the two specified float numbers.

Example #1:




// Scala program of Float max()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying max method
        val result = (5.9).max(9.0)
          
        // Displays output
        println(result)
      
    }

Output:

9.0

Example #2:




// Scala program of Float max()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying max method
        val result = (5.0).max(5.0)
          
        // Displays output
        println(result)
      
    }

Output:

5.0

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!