我很困惑。下面的代碼有錯誤(「...」表示消隱碼):最終公共靜態int不能用在switch語句中?
int byteOrder = ...;
switch (byteOrder)
{
case HDF5Constants.H5T_ORDER_BE:
return ByteOrder.BIG_ENDIAN;
...
}
的錯誤是在case語句和Eclipse抱怨‘CASE表達式必須是常量表達式’。我看着這個源文件中,它有行這樣一個長長的清單:
final public static int H5T_ORDER_BE = H5.J2C(JH5T_ORDER_BE);
我想你可以使用final public static int
常量案件switch語句。我錯了嗎???