EDIT: my title should have said "Define enum data type in one class and use in another" sorry
i know, create a getter method but what i need to do is like in C, how we use headers to define data types and include that header, i want to define an enum in a java class only once and use it everywhere in my package. here is my example :
in eclipse, it gives me an error even at the import statement (everything's in teh same package) : import WlanLayer cannot be resolved
can someone please help me with the correct syntax ? thanks!
i know, create a getter method but what i need to do is like in C, how we use headers to define data types and include that header, i want to define an enum in a java class only once and use it everywhere in my package. here is my example :
Code:
public class WlanLayer {
/** Enum of status flags
*/
public enum Status {
SUCCESS(1), UNSPECIFIED_ERROR(2);
private int value;
private Status(int value) {
this.value = value;
}
};
}
import WlanLayer.Status;
public class Node {
public Status method()
{
// here, i want to set the status flag, to
// an enum value, init to success
Status s = Status.SUCCESS;
// oh no, some error just happened after statements
s = Status.UNSPECIFIED_ERROR;
}
}
in eclipse, it gives me an error even at the import statement (everything's in teh same package) : import WlanLayer cannot be resolved
can someone please help me with the correct syntax ? thanks!