Quick actions

cmd+k|ctrl+k

Navigation

Languages

ENUM

Snippet info

Language

Java

Visibility

public

Author

jsonkody

Created

2019-12-19T10:22:15Z

Updated

2019-12-19T10:22:15Z

enum Color {
    RED(3),
    GREEN(8),
    BLUE(12)
    ;
    
    
    private int transparency;
    
    Color(int transparency) {
        this.transparency = transparency;
    }
    
    public int getTransparency() {
        return this.transparency;
    }
}


class Main {
    public static void main(String[] args) {
        
        Color red = Color.BLUE;
        System.out.println(red + " has transparency level " +red.getTransparency());
    }
}
INFO