I have given an enum ABC and a class Test and I have to call doSomething but I cannot pass ABC enum as parameter.
enum ABC{
A,B,C;
}
Class Test{
public void doSomething(ABC abc)
{
//some work
}
}
Here I want an enum DEF that should have all member of ABC and it should also have member of enum XYZ (I want an enum DEF that should contain members of two enums(ABC and XYZ)). Example like this.
enum DEF
{
A,B,C,X,Y,Z,D;
}
enum xyz{
X,Y,Z;
}
So that I can call doSomething method which takes only ABC enum as parameter. I want to call doSomething() method with DEF.Example
class Demo{
public static void main(String[] ags)
{
Test test= new Test();
test.doSomething(DEF.A);
}
}
I am fresher. Kindly provide me any help or suggestion.I will be thankful to you.