Open In App

Scala Int byteValue() method with example

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

The byteValue() method is utilized to return the byte value of the specified int value.

Method Definition: def byteValue(): Byte

Return Type: It returns the byte value of the given int value.

Example #1:




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


Output:

15

Example #2:




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


Output:

50


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

Similar Reads