Java Constants: Declare with Final Keyword
In Java, a constant is typically declared using the keyword final to indicate that the value of the variable cannot be changed. For example:
public class Constants {
public static final int MAX_VALUE = 100;
public static final String GREETING = "Hello";
}
In the example above, MAX_VALUE and GREETING are declared as constants, whose values cannot be changed during the program execution. Constants are typically named in uppercase letters to distinguish them from regular variables.