error: an enum switch case label must be the unqualified name of an enumeration constant

前端 未结 1 1150
鱼传尺愫
鱼传尺愫 2021-01-17 14:47

error: an enum switch case label must be the unqualified name of an enumeration constant error: duplicate case label

no compiling, hel

相关标签:
1条回答
  • 2021-01-17 15:25

    As per Java docs

    The Identifier in a EnumConstant may be used in a name to refer to the enum constant.

    so we need to use the name only in case of an enum.

    Change to this

    switch (Prefs.getCardStyle()) {
        case COMPACT: rCompact.setChecked(true); break;
        case FLAT: rFlat.setChecked(true); break;
        case MATERIAL: default: rMaterial.setChecked(true); break;
    }
    
    0 讨论(0)
提交回复
热议问题