Scala Int floatValue() 方法及示例
floatValue() 方法用于返回指定 int 值的浮点值。
方法定义:def floatValue(): Byte
返回类型:返回给定 int 值的浮点值。
示例 #1:
// Scala program of Int floatValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying floatValue method
val result = (15).floatValue
// Displays output
println(result)
}
}
15.0
示例 #2:
// Scala program of Int floatValue
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying floatValue method
val result = (1586).floatValue
// Displays output
println(result)
}
}
1586.0
阅读更多:Scala 教程
极客教程