Data Type in Scala

Updated: 01/08/2022 by Computer Hope

The rules Scala uses for literals are simple and intuitive. This section explains all basic Scala Literals.

String Literals :

"Hello,\nWorld!" "This string contains a \" character."

Multi-Line Strings:

"""the present string div three lines.""

Character Literals

'a'
'\n'
'\t'

Data Type of Scala

  • 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