Java - Constant


The names of constant fields are in upper-case letters.

By convention, the names of constant values are spelled in uppercase letters. If the name is composed of more than one word, the words are separated by an underscore (_).


static final

You can create a class variable A constant member is defined with the modifier static and final.

final class Constants {

    static final char BACKSPACE = '\b';
    static final char COMMA = ',';

And import it in your other class, if you don't want to use the qualified name:

import static gerardnico.Constants.*;


Powered by ComboStrap