Computer Science, asked by rahulrahul43107, 7 months ago

What is a literal? Explain the types of literals?

Answers

Answered by PrakulSharma
36

Answer:

They are used to represent the constant value. Literals are source code representation of a fixed value or the sequence of characters which represents the constant value that is to be stored in a variable. There are five types of literals in Java. Integer Literals. Boolean Literals.

please mark as brainlist mare 2 answer ko brainlist krdo

Answered by TeraBhaii
22

\huge{\underline{\frak{Literals:-}}}

  • Literals are data items that have a fixed/constant value.

The types of Literals can be summarised as follows:

\large{\bigstar{\underline{\textrm{String Literals:-}}}}

A string literal is a sequence of characters surrounded by quotes ( single or double or triple)

\large{\bigstar{\underline{\textrm{Numeric Literals:-}}}}

Numeric literals are numeric values and these can be one of the following types :-

  • Int( signed integers) often called just integers are positive or negative whole numbers with no decimal point.
  • Floating point literals represent real numbers and are written with a decimal point dividing the integer and fractional parts are number having fractional parts.
  • Complex number literal are if form a+bj where a and b aew floats and j represents √-1.

\large{\bigstar{\underline{\textrm{Boolean  Literals:-}}}}

A Boolean Literal in python is used to represent one of the two Boolean values ie true or false.

\large{\bigstar{\underline{\textrm{Special Literal None:-}}}}

Python has one special literal which is None. The none Literal is used to indicate absence of value.

Similar questions