I have this enum :
public class RemoteUnitType implements Serializable {
public enum deviceVersion {
ANDROID_AT1,
ANDROID_AT1_PRO,
ANDROID_AT5,
ANDROID_AK1
}
and I want to create a switch on Enum, like this
switch (remoteUnit.getDeviceVersion()) {
case RemoteUnitType.deviceVersion.ANDROID_AK1 :
break;
}
But I got this error:
The qualified case label RemoteUnitType.deviceVersion.ANDROID_AK1 must be replaced with the unqualified enum constant
You do not need to qualify, just use the enumeration's label:
switch (remoteUnit.getDeviceVersion()) {
case ANDROID_AK1 :
break;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With