Open In App

Scala Byte toInt() method

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

In Scala, Byte is a 8-bit signed integer (equivalent to Java’s byte primitive type). The toInt() method is utilized to convert the specified number into Int datatype value.

Method Definition: (Number).toInt

Return Type: It returns converted Int value.

Example #1:




// Scala program of Byte toInt() 
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying toInt method 
        val result = (13).toInt
          
        // Displays output 
        println(result) 
      
    


Output:

13

Example #2:




// Scala program of Byte toInt() 
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying toInt method 
        val result = (123.4).toInt
          
        // Displays output 
        println(result) 
      
    


Output:

123


Similar Reads

Scala Short toInt() method
Short, a 16-bit signed integer (equivalent to Java’s short primitive type) is a subtype of scala.AnyVal. The toInt() method is utilized to convert the specified number into Int datatype value. Method Definition: (Number).toInt Return Type: It returns converted Int value. Example #1: // Scala program of Short toInt() // method // Creating object obj
1 min read
Scala Char toInt() method with example
The toInt() method is utilized to convert a stated character into an integer or its ASCII value of type Int. Method Definition: def toInt: Int Return Type: It returns Integer or ASCII value of the corresponding character of type Int. Example: 1# // Scala program of toInt() // method // Creating object object GfG { // Main method def main(args:Array
1 min read
Scala Float toInt() method with example
The toInt() method is utilized to convert the specified number into integer value. Method Definition: (Number).toInt Return Type: It returns the converted integer value. Example #1: // Scala program of Float toInt() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying toInt method val result = (9.7).to
1 min read
Scala Int toInt() method with example
The toInt() method is utilized to convert the specified int number into float int type value. Method Definition: (Number).toIntReturn Type: It returns the converted int datatype value. Example 1: C/C++ Code // Scala program of Int toInt() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying toInt metho
1 min read
Scala Byte !=(x: Byte): Boolean
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method !=(x:Byte) method is utilized to return true if the value is not equal to the specified value x, otherwise returns false. Method Definition: Byte !=(x: Byte): Boolean Return Type: It returns true if the value is not equal to the specified value, otherwis
1 min read
Scala Byte &(x: Byte): Int
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method &(x:Byte) method is utilized to return the bitwise AND of this value and x. Method Definition: Byte &(x: Byte): Int Return Type: It returns the bitwise AND of this value and x. Example #1: // Scala program of Byte &(x: Byte) // method // Crea
1 min read
Scala Byte *(x: Byte): Int
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method *(x:Byte) method is utilized to return the product of this value and x. Method Definition: Byte *(x: Byte): Int Return Type: It returns the product of this value and x. Example #1: // Scala program of Byte *(x: Byte) // method // Creating object object G
1 min read
Scala Byte <(x: Byte): Boolean
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method <(x:Byte) method is utilized to return true if this value is less than x, false otherwise. Method Definition: Byte <(x: Byte): Boolean Return Type: It returns true if this value is less than x, false otherwise. Example #1: // Scala program of Byte
1 min read
Scala Byte <=(x: Byte): Boolean
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method <=(x:Byte) method is utilized to return true if this value is less than or equal to x, false otherwise. Method Definition: Byte <=(x: Byte): Boolean Return Type: It returns true if this value is less than or equal to x, false otherwise. Example #1:
1 min read
Scala Byte >(x: Byte): Boolean
In Scala, Byte is a 8-bit signed integer (equivalent to Java's byte primitive type). The method >(x:Byte) method is utilized to return true if this value is greater than x, false otherwise. Method Definition: Byte >(x: Byte): Boolean Return Type: It returns true if this value is greater than x, false otherwise. Example #1: // Scala program of
1 min read
Article Tags :