Skip to content
Related Articles

Related Articles

Scala Int getClass() method with example

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 30 Jan, 2020
Improve Article
Save Article

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

Method Definition: (Number).getClass

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

Example #1:




// Scala program of Int 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 Int getClass()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying getClass method
        val result = (27987696).getClass
          
        // Displays output
        println(result)
      
    }


Output:

int

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!