Open In App

Scala Int shortValue() method with example

Last Updated : 30 Jan, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The shortValue() method is utilized to return the short value of the specified value.

Method Definition: def shortValue(): Byte

Return Type: It returns the short value of the given value.

Example #1:




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


Output:

15

Example #2:




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


Output:

1586


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads