// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class EnumPersistance {
    public static void main(String[] args) {
        X v = X.A;
        System.out.println(v);
        String s = v.toString();
        X v2 = Enum.valueOf(X.class, s);
        System.out.println(v2);
    }
}

enum X { A, B }
