What are constants?

Constant refers to data whose value remains unchanged during the entire operation. Its value is usually given directly in a command or program. They can be certain quantities and information that do not change with time, or they can be characters or strings representing a certain value. They are often used to identify, measure and compare.

Numeric constants are represented by integers, decimals, and scientific notation, such as 1234, 555.33, 4.5E, etc.; character constants are enclosed by delimiters such as half-width single quotes, double quotes, or square brackets. A string of characters; logical constants have only two values: logical true and logical false. Logical true uses .T. (.t.) or .Y. (.y.), and logical false uses .F (.f.) or . N.(.n.).

Extended information:

Constants in Java

In the Java language, the final keyword is mainly used (the final keyword is used flexibly in Java classes ) to define constants. The basic data types of Java are the data types provided by the ava language itself and are the basis for referencing other types. Java's basic data types are divided into four types: integer type, floating point type, character type, and Boolean type.

The scope of use of the final keyword. This final keyword can not only be used to modify constants of basic data types, but also can be used to modify references or methods of objects.

Baidu Encyclopedia-Constant