Open In App

Scala Int equals(arg0: Any) method with example

Improve
Improve
Like Article
Like
Save
Share
Report

The equals(arg0: Any) method is utilized to return true if the two specified int value is equal else false.

Method Definition: def equals(arg0: Any): Boolean

Return Type: It returns true if the two specified int value is equal else false.

Example #1:




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


Output:

false

Example #2:




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


Output:

true


Last Updated : 30 Jan, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads