Loading...

Char Literals

A char literal can be represented as single character with single quotes.Example:1. char c=’a’; //(valid)2. char c=”a”; //(invalid)3. char c=a; //(invalid)4. char c=’abc’; //(invalid) Char literal can also be specified [ … ]

Boolean Literals

Boolean type values are true or false only in lower case.Example:1. boolean b=false; //(valid)2. boolean b=0; //(invalid)3. boolean b=False; //(invalid)4. boolean b=”false”; //(invalid)

Floating Point Literals

Floating point literals is by default double type. But it can be explicitly as float type by suffixing with f or F.Example:float f=123.546; //(invalid)float f=123.546f; //(valid)double d=123.546; //(valid) Floating point [ … ]

Literals

Any constant value which are assigned to the variables are called literal. Example:int x=10 int —-> datatype|keywordx ——-> name of variable|identifier10 —–> constant value|literal

Char Data Type

Char Data Type:In previous languages like C and C++ are ASCII code based the number of ASCII code characters are <256 to represent these 256 characters 8-bits enough hence char [ … ]