Open In App

Scala Long *(x: Char) method

In Scala, Long is a 64-bit signed integer, which is equivalent to Java’s long primitive type. The *(x: Char) method is utilized to return the product of the specified Long value and Char value.

Method Definition – def *(x: Char)



Returns – Returns the product of this value and x.

Example #1:




// Scala program to explain working of
// Long *(x: Char) method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying *(x: Char) function
        val result = (10.toLong).*('A':Char)
          
        // Displays output
        println(result)
      
    }

Output:



650

 

Example #2:




// Scala program to explain working of
// Long *(x: Char) method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying *(x: Char) function
        val result = (150.toLong).*('G':Char)
          
        // Displays output
        println(result)
      
    }

Output:

10650

Article Tags :