Scala – Literals

  • date 29th December, 2020 |
  • by Prwatech |

The literals are a series of symbols utilized for describing a constant value in the code. 

                                               Types of Literals

Integer Literals: The Integer literals are generally of type Int or of type Long when a suffix L or l is added at the end of the Integers.

Run the following example for Integer Literals:


Floating Point Literals : This type of literals are of type Double as well as type Float .

Run the following example for Floating Point Literals:



Character Literals : They are either uni-code character which are printable or are represented by escape sequences.

Run the following example for Character Literals:


String literals : The String literals are series of characters, which are available in double quotes.

Run the following example for String Literals:



Multi-Line String Literals : The multi-line string literals are also series of characters but it has multiple lines.

Run the following example for Multi-Line String Literals :


Quick Support

image image