using enum values as string literals

Solutions on MaxInterview for using enum values as string literals by the best coders in the world

showing results for - "using enum values as string literals"
Martina
24 Aug 2020
1public enum Country{
2    SPAIN("España"),
3    ITALY("Italia"),
4    PORTUGAL("Portugal");
5
6
7    private String value;
8
9    Country(final String value) {
10        this.value = value;
11    }
12
13    public String getValue() {
14        return value;
15    }
16
17    @Override
18    public String toString() {
19        return this.getValue();
20    }
21}
22
similar questions
java string enum