Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How do I write constants names in Java?
While writing the name of the constants it is suggested to
- write all the letters in upper case.
- If constant contains more than one word they should be separated by underscore (_).
Example
public class ConstantsTest {
public static final int MIN_VALUE = 22;
public static final int MAX_VALUE = 222;
public static void main(String args[]) {
System.out.println("Value of the constant MIN_VALUE: "+MIN_VALUE);
System.out.println("Value of the constant MAX_VALUE: "+MAX_VALUE);
}
}
Output
Value of the constant MIN_VALUE: 22 Value of the constant MAX_VALUE: 222
Advertisements
