Scala

10 / 51
   

Scala - Data Types

Scala has all the same data types as Java, with the same memory footprint and precision.

You will notice that integers and strings are the most commonly used data types to represent the real world entities.

Let's have a look at Scala data types.

Byte - 8 bit signed value. Range from -128 to 127

Short - 16 bit signed value. Range -32768 to 32767

Int - 32 bit signed value. Range -2147483648 to 2147483647

Long - 64 bit signed value. -9223372036854775808 to 9223372036854775807

Float - 32 bit IEEE 754 single-precision float

Double - 64 bit IEEE 754 double-precision float

Char - 16 bit unsigned Unicode character. Range from U+0000 to U+FFFF

String - A sequence of Chars

Boolean - Either the literal true or the literal false

Unit - Corresponds to no value

Null - null or empty reference

Nothing - The subtype of every other type; includes no values

Any - The supertype of any type; any object is of type Any

AnyRef - The supertype of any reference type