Scala Float getClass() 方法及示例

Scala Float getClass() 方法及示例

getClass() 方法 用于返回给定数字的类。

方法定义:(Number).getClass

返回类型:返回给定数字的类。

示例 #1:

// Scala program of Float getClass()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying getClass method
        val result = (2).getClass
          
        // Displays output
        println(result)
      
    }
} 
int

示例 #2:

// Scala program of Float getClass()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying getClass method
        val result = (2.6).getClass
          
        // Displays output
        println(result)
      
    }
} 
double

更多Scala相关文章,请阅读:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程