Why can't your switch statement data type be long Java?

Posted by Fostah on Stack Overflow See other posts from Stack Overflow or by Fostah
Published on 2010-04-20T15:07:01Z Indexed on 2010/04/20 15:13 UTC
Read the original article Hit count: 155

Filed under:

Here's an excerpt from Sun's Java tutorials:

A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer (discussed in Simple Data Objects ).

There must be a good reason why the long primitive data type is not allowed. Anyone know what it is?

© Stack Overflow or respective owner

Related posts about java