Scala Byte toDouble() 方法
在Scala中,Byte是一个8位有符号整数(相当于Java的byte基本类型)。toDouble()方法用于将指定的数值转换为Double数据类型的值。
方法定义:(数值)。toDouble
返回类型:返回转换后的Double值。
示例1:
// Scala program of Byte toDouble()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toDouble method
val result = (13).toDouble
// Displays output
println(result)
}
}
输出:
13.0
示例2:
// Scala program of Byte toDouble()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toDouble方法
val result = (123).toDouble
// Displays output
println(result)
}
}
输出:
123.0
更多Scala相关文章,请阅读:Scala 教程