Labels

Monday, April 11, 2022

Data Types in Scala (Class -29)

 In a programming language, a data type is also known as type, tells the compiler about the type of data that is used by the programmer.

The Scala data types are taken as it is from Java and the storage and length are the same. There are many different types of data types in Scala.

1 Byte = 8 Bits.

Data Types

Values

Storage

Default Value

Usage

Boolean

True / False

2 Bytes

FALSE

Only 2 values.

Integer

minus 2147483648 to 2147483647

4 bytes

0

Commonly used in programming.

Float

IEEE 754 single-precision float.

4 Bytes

0.0F

For the decimal point numbers.

Double

IEEE 754 double-precision float.

8 Bytes

0.0D

To handle decimal point numbers that needs larger value and more precision.

Char

0 to 216-1 Unicode

2 Bytes

\u000'

To handle character assignments stored as unsigned Unicode characters.

String

any length

40 Bytes (Empty String)

Null

Used to store a character sequence in a program.


No comments:

Post a Comment