Scala Int toByte() method with example
Last Updated :
04 Feb, 2020
The toByte() method is utilized to convert the specified int number into Byte data type value.
Method Definition: (Number).toByte
Return Type: It returns the converted byte datatype value.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 66 ).toByte
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = ( 129 ).toByte
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...