2011-11-01

Types of Literals and their default datatypes

All Integer type Literals are by default of type int. If we want to represent them as long we must suffix 'l' or 'L' to the Literal. we do not have byte or short type Literals.

All floating type Literals are of type double by default. If we want to represent them as float we must suffix 'f' or 'F' to the Literals.

The data placed inside single quote is considered as char Literal

Rule: In single quote we are not allowed to place more than one character. We can place either '0' or '1' characters.

The data placed inside double quotes is considered as String Literal

Note: In double quotes we can place '0' or 'n' number of characters.


Below are the following Literals in Java





Comment for any doubts.....

Loading

Enter your Email here: