Scala Int floatValue() 方法及示例

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 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程