Open In App

Scala Int toOctalString() method with example

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

The toOctalString() method is utilized to return the octal form of the specified integer value.

Method Definition: def toOctalString: String

Return Type: It returns the octal form of the specified integer value.

Example #1:




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


Output:

5

Example #2:




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


Output:

11


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

Similar Reads