How to create constants in Java language

Опубликовано: 08 Июнь 2026
на канале: M BA
144
2

For the video, I am using the "vi" editor, but you can use any other editor. If you prefer, you can use an IDE (integrated development environment) such as Eclipse, NetBeans, IntelliJ IDEA ...

For the creation of constants:

Use the keyword "static" and "final" to create a constant
Each constant has a type (int, float, ...) associated

And follow the following recommendations.

Create all the constants of the application in a single separate file.
Use the capital letters to call the constants
If the name of the constant is composed, use the underscore to divide the words

Note that a constant is an immutable variable.