Scala Int toOctalString() 方法与示例
toOctalString()方法用于返回指定整数值的八进制形式。
Method Definition: def toOctalString: String
Return Type: It returns the octal form of the specified integer value.
示例 #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)
}
}
输出:
5
示例 #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)
}
}
输出:
11