Scala Data Type – Description

Sr.No Data Type & Description
1 Byte

8 bit signed value. Range from -128 to 127

2 Short

16 bit signed value. Range -32768 to 32767

3 Int

32 bit signed value. Range -2147483648 to 2147483647

4 Long

64 bit signed value. -9223372036854775808 to 9223372036854775807

5 Float

32 bit IEEE 754 single-precision float

6 Double

64 bit IEEE 754 double-precision float

7 Char

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

8 String

A sequence of Chars

9 Boolean

Either the literal true or the literal false

10 Unit

Corresponds to no value

11 Null

null or empty reference

12 Nothing

The subtype of every other type; includes no values

13 Any

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

14 AnyRef

The supertype of any reference type

All the data types listed above are objects. There are no primitive types like in Java. This means that you can call methods on an Int, Long, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s