Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Enum confusion! Logical or in an if statement

843789May 14 2009 — edited May 14 2009
I'm using enums for the first time and I'm a bit confused.

I have:
if (type != (Board.PIT | Board.NORMAL | Board.PAIR | Board.ROT | Board.UNDER
    			Board.NORTH | Board.EAST | Board.SOUTH | Board.WEST) )
    	isUpper = true;	
Eclipse gives me the warning "The operator | is undefined for the argument type(s) boolean, Board.PIT."

Okay, so if I can't use |, what am I supposed to use instead? I could make a switch, but that would be very repetitive, so surely that's not the best way to do it:
switch(type) {
    	
    	case PIT: isUpper = true;
    	case NORMAL: isUpper = true;
...and so on.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2009
Added on May 14 2009
4 comments
622 views