📜  带有示例的 Scala Float getClass() 方法

📅  最后修改于: 2022-05-13 01:55:48.368000             🧑  作者: Mango

带有示例的 Scala Float getClass() 方法

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