Mega Code Archive

 
Categories / Java Tutorial / Language
 

Define constant

'public static final' variables are constant. The naming convention for static final variables is to have them in upper case and separate two words with an underscore. For example: static final int NUMBER_OF_MONTHS = 12; static final float PI = (float) 22 / 7; If you want to make a static final variable accessible from outside the class, you can make it public too: public static final int NUMBER_OF_MONTHS = 12; public static final float PI = (float) 22 / 7;