📜  带有示例的 Scala Float toChar() 方法

📅  最后修改于: 2022-05-13 01:55:49.859000             🧑  作者: Mango

带有示例的 Scala Float toChar() 方法

toChar()方法用于将指定的数字转换为字符值。这里指定的数字是 ASCII 值。

示例 #1:

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

示例 #2:

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