In this post, we will discuss the Java constants naming conventions with examples.
Read complete Java naming conventions at https://www.javaguides.net/2018/08/java-standard-naming-conventions.html.
Read complete Java naming conventions at https://www.javaguides.net/2018/08/java-standard-naming-conventions.html.
Constants naming conventions
Constant variable names should be written in upper characters separated by underscores. These names should be semantically complete and clear.
Example:
RED, YELLOW, MAX_PRIORITY, MAX_STOCK_COUNT
Make sure to use the final modifier with constant variables.
public final String SECURITY_TOKEN = "...";
public final int INITIAL_SIZE = 16;
public final Integer MAX_SIZE = Integer.MAX;
Comments
Post a Comment