I am trying to import an enum
from from another file. I have following code in the first file :
public class Colour {
public enum Color {
RED, ORANGE, YELLOW, GREEN, BLUE, BLACK, WHITE; // ; is optional
@Override
public String toString() {
switch (this) {
case RED:
return "red";
case ORANGE:
return "orange";
case YELLOW:
return "yellow";
case GREEN:
return "green";
case BLUE:
return "blue";
case BLACK:
return "black";
case WHITE:
return "white";
default:
throw new IllegalStateException();
}
}
}
Now I want to import these into another, lets say the class Test
.
public class Test { }
How would I do that in both files? Thanks