What is a literal? Explain the types of literals?
Answers
Answered by
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
22
- Literals are data items that have a fixed/constant value.
The types of Literals can be summarised as follows:
A string literal is a sequence of characters surrounded by quotes ( single or double or triple)
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.
A Boolean Literal in python is used to represent one of the two Boolean values ie true or false.
Python has one special literal which is None. The none Literal is used to indicate absence of value.
Similar questions
English,
3 months ago
Computer Science,
7 months ago
Chinese,
7 months ago
Computer Science,
11 months ago