In Scala, there are mainly 7 numeric types .These numeric types are Byte, Char, Double, Float,Int,Long, and Short. All numeric types are object.
Data ranges of Scala’s built-in numeric types are as follows :-
Above was the brief introduction of numeric data type .
Now , we will see, how can we override the default Numeric Type .
Here, we assign 100 to a variable , Scala assign it the type Int
Overriding simple numeric type
Approach 2 :
You can also define the variable types as below