Open In App

Scala Float getClass() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The getClass() method is utilized to return the class of the given number.

Method Definition: (Number).getClass

Return Type: It returns the class of the given number.

Example #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)
      
    }


Output:

int

Example #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)
      
    }


Output:

double


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads