In java String parameter storage switch

Before jdk 7, switch only supports byte, short, char, int these basic data types and their corresponding package type. Brackets behind the switch can only put an int, but the byte, short, char type, they are automatically converted to an int (small fine precision conversion to large), they are also supported.

Note that, for precision greater than int type, such as long, float, doulble, does not automatically converted to int, if you want to use, must be converted int strong, such as (int) a float;

Guess you like

Origin www.cnblogs.com/hairfbk/p/12001298.html