Tuesday, February 12, 2013

SCJP: switch statement

A trick usual to be found concerns the type of the switch expression.
Only int convertibles or enums can be used in the switch expression.
long values fails to compile.

Wrong:

long l=0;
switch(l){
//...
}

No comments:

Post a Comment