Skip to content
Related Articles

Related Articles

Improve Article

Scala Char max() method with example

  • Last Updated : 03 Nov, 2019
Geek Week

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

Method Definition: def max(that: Char): Char

Return Type: It returns the character 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 = ('F').max('A')
          
        // Displays output
        println(result)
      
    }
Output:
F

Example: 2#




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



My Personal Notes arrow_drop_up
Recommended Articles
Page :