Skip to main content
better example
Source Link
Ray Tayek
  • 300
  • 1
  • 4

you can sorta do nested enums:

enum Animaldogs {
    Catboxer, Dog;collie;
}
enum cats {
    siamese, tom
}
enum Animal {
    cat(cats.tom), dog(dogs.boxer);
    Animal(Enum e) {
        tom,this.e manx;= e;
    }
    enumObject[] dogsubValues() {
        collie,return greyhound;e.getDeclaringClass().getEnumConstants();
    }
    final Enum e;
}
public class Main {
    public static void main(String[] args) {
        System.out.printlnfor (Animal animal : Animal.Catvalues();) {
            System.out.printlnprint(Animal.cat.tomanimal);
            for (Object o : animal.subValues())
                System.out.printlnprint(Animal.Dog" " + o);
            System.out.println(Animal.dog.collie);
        }
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

you can sorta do nested enums:

enum Animal {
    Cat, Dog;
    enum cat {
        tom, manx;
    }
    enum dog {
        collie, greyhound;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println(Animal.Cat);
        System.out.println(Animal.cat.tom);
        System.out.println(Animal.Dog);
        System.out.println(Animal.dog.collie);
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

you can sorta do nested enums:

enum dogs {
    boxer, collie;
}
enum cats {
    siamese, tom
}
enum Animal {
    cat(cats.tom), dog(dogs.boxer);
    Animal(Enum e) {
        this.e = e;
    }
    Object[] subValues() {
        return e.getDeclaringClass().getEnumConstants();
    }
    final Enum e;
}
public class Main {
    public static void main(String[] args) {
        for (Animal animal : Animal.values()) {
            System.out.print(animal);
            for (Object o : animal.subValues())
                System.out.print(" " + o);
            System.out.println();
        }
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

clarify
Source Link
Ray Tayek
  • 300
  • 1
  • 4

you can sorta do nested enums:

enum Animal {
    Cat, Dog;
    enum cat {
        tom, manx;
    }
    enum dog {
        collie, greyhound;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println(Animal.Cat);
        System.out.println(Animal.cat.tom);
        System.out.println(Animal.Dog);
        System.out.println(Animal.dog.collie);
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

you can do nested enums:

enum Animal {
    Cat, Dog;
    enum cat {
        tom, manx;
    }
    enum dog {
        collie, greyhound;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println(Animal.Cat);
        System.out.println(Animal.cat.tom);
        System.out.println(Animal.Dog);
        System.out.println(Animal.dog.collie);
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

you can sorta do nested enums:

enum Animal {
    Cat, Dog;
    enum cat {
        tom, manx;
    }
    enum dog {
        collie, greyhound;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println(Animal.Cat);
        System.out.println(Animal.cat.tom);
        System.out.println(Animal.Dog);
        System.out.println(Animal.dog.collie);
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.

Source Link
Ray Tayek
  • 300
  • 1
  • 4

you can do nested enums:

enum Animal {
    Cat, Dog;
    enum cat {
        tom, manx;
    }
    enum dog {
        collie, greyhound;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println(Animal.Cat);
        System.out.println(Animal.cat.tom);
        System.out.println(Animal.Dog);
        System.out.println(Animal.dog.collie);
    }
}

i wrote some code for an ad&d 2.0 game here that has character classes, races, weapons classes and a dice roller that may be useful.