Scala Float toByte() method with example
Last Updated :
29 Oct, 2019
The toByte() method is utilized to convert the specified number into Byte data type value. The range of the byte data type is from -128 to 127.
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)
}
}
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...