Is there a maximum number of Enum items?

The documentation on Enums doesn’t specify:

Is there a maximum number of Enum items?


Yes, the maximum number is 100. If you try to compile this class:

public Enum Demo
    A001, A002, A003, A004, A005, A006, A007, A008, A009, A010,
    A011, A012, A013, A014, A015, A016, A017, A018, A019, A020,
    A021, A022, A023, A024, A025, A026, A027, A028, A029, A030,
    A031, A032, A033, A034, A035, A036, A037, A038, A039, A040,
    A041, A042, A043, A044, A045, A046, A047, A048, A049, A050,
    A051, A052, A053, A054, A055, A056, A057, A058, A059, A060,
    A061, A062, A063, A064, A065, A066, A067, A068, A069, A070,
    A071, A072, A073, A074, A075, A076, A077, A078, A079, A080,
    A081, A082, A083, A084, A085, A086, A087, A088, A089, A090,
    A091, A092, A093, A094, A095, A096, A097, A098, A099, A100,

You will get this error:

Maximum number of enum items exceeded: 100

Source : Link , Question Author : Adrian Larson , Answer Author : Adrian Larson

Leave a Comment