0

I am having trouble with some java code:

I created a class named clsEnum, and I want it to contain not just one class.

enum EnumDocument
{
    DNI(1), RUC(5), Grupo(7),Sucursal(8);

    private int value;

    EnumDocument(int value){
        this.value = value;
    }

    public int getValue(){
        return this.value;
    }
}

enum EnumTypeRoleCredential
{
    Employee(81), Client(82), Supplier(83);
    private int value;

    EnumTypeRoleCredential(int value){
        this.value = value;
    }

    public int getValue(){
        return this.value;
    }
}

Yes I know, I forgot to put the main class(clsEnum), but in this case I dont want to put it. This is the way I want it to work. So, when a I create an enumDocument object or a EnumTypeRoleCredential object, in a class wich is in the same package, I dont have any problem, but when I create an object in another class wich is in another package, the IDE(Eclipse juno) suggest to use "public", but when y use it, i get an error that says that the class needs its own file.

I use to do this en Visual Studio c#.net. Can it be done in Java, or i have to put necessary the subclasses into the main class.

Thanks.

4

3 に答える 3