Scala Int toChar() 方法与示例
toChar()方法用于将指定的 int 数转换为 char 类型的值。
Method Definition: (Number).toChar
Return Type: It returns the converted char datatype value.
示例 #1:
// Scala program of Int toChar()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toChar method
val result = (64).toChar
// Displays output
println(result)
}
}
输出:
@
示例 #2:
// Scala program of Int toChar()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toChar method
val result = (68).toChar
// Displays output
println(result)
}
}
输出:
D