Scala Int floatValue() 方法与示例
floatValue()方法用于返回指定 int 值的浮点值。
Method Definition: def floatValue(): Byte
Return Type: It returns the float value of the given int value.
示例 #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