Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Using enum values as string literals

public enum Country{
    SPAIN("España"),
    ITALY("Italia"),
    PORTUGAL("Portugal");


    private String value;

    Country(final String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return this.getValue();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java files 
Java :: dequeue in java 
Java :: java write in a file without overwriting 
Java :: replace regex group() java 
Java :: java string length validation regex 
Java :: how to change actionbar color in android programmatically 
Java :: java dimension 
Java :: java wait(timeout) 
Java :: java for loop increment by 3 
Java :: dot operator java 
Java :: variables java 
Java :: java final meaning 
Java :: insert string in string java 
Java :: map java 
Java :: java input string with spaces 
Java :: android canvas line thickness 
Java :: BufferredReader Class 
Java :: java find if element of list in present in another list 
Java :: string array to stringbuilder array java 
Java :: Add month to date in java 8 
Java :: regex pattern for bank cards validation 
Java :: file java class 
Java :: get key from value hashmap 
Java :: Android: remove shadow from bottom navigation 
Java :: keytool error: java.lang.Exception: Key pair not generated, alias <demo already exists 
Java :: how to put string in char array in java tutorialspoint 
Java :: Create class from string variable JAVA 
Java :: throw and throws keyword in java 
Java :: convertir string a char java 
Java :: How to get a context in a recycler view adapter 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =