what are constants in java?
Answers
Answered by
4
A constant is a variable whose value cannot change once it has been assigned. Java doesn't have built-in support for constants, but the variable modifiers static and final can be used to effectively create one.
PLEASE MAKE ME AS A BRAINLIST ANSWER
Answered by
5
Answer:
- Literals often referred to as constants are data items that are fixed data values.
- Java allows several kinds of literals:
- Integer-literal
- Floating literals
- Boolean literal
- Character literal
- String literal
- The null literal
- An integer constant must have at least one digit and must not contain any decimal point.
- It may contain either + or - sign.
- A number with no sign is assumed to be positive.
- Commas cannot appear in an integer constant.
- Real literal in fractional form must have at least one digit before a decimal point and at least one digit after the decimal point.
- It may also have either + or - sign preceding it.
- A real literal with no sign is assumed to be positive.
- Real literal in exponent form has two parts : a mantissa and an exponent.
- the mantissa must be either an integer or proper real literal.
- The mantissa is followed by a letter E or e and the exponent.
- The exponent must be an integer.
Similar questions