Cannot refer to my enum with import static java
pI have a hard time referring to my enum from codeimport static/code./p
pEvery file in the program is in a package./p pEnum file:/p precodepublic
enum myEnum { A, B, C; public static boolean aMethod (myEnum e) { return
something; //nevermind this returnvalue. } } /code/pre pAnd the file who
is importing this:/p precodeimport static myEnum.*; public class myClass {
public static void someMethod() { myEnum e; if ( aMethod(e) ) { // doing
something } } } /code/pre pSo I want to make this codemyEnum e;/code in
codemyClass/code, so that I may give codee/code as parameter to
codeaMethod/code. But when I do this I get compiler error:/p precodecannot
find symbol class myEnum /code/pre pNote: this enum has maaany more
attributes in the actual program. So I am not supposed to specify a
certain attribute in codesomeMethod/code. /p pThanks in advance for any
help./p
No comments:
Post a Comment