Open In App

Scala Char getClass() method with example

Last Updated : 03 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The getClass() method is utilized to return the run-time class representation of the stated object.

Method Definition: def getClass(): Class[Char]

Return Type: It returns the class of the stated object.

Example: 1#




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


Output:

char

Example: 2#




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


Output:

char


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads