public class Enumvalues{
enum courseList {
JAVA,
C,
PYTHON,
PERL
}
enum generalInformation {
NAME,
AGE,
An enum is a class. So you can pass an instance of the class (EnumValues.generalInformation.PHONE
for example), or you can pass the class itself (EnumValues.generalInformation.class
for example).
If you want to list all the instances of an enum class, you need to pass the enum class, and use EnumSet.allOf(EnumValues.generalInformation.class)
for example.
Your confusion principally comes from the fact that you don't respect the Java naming conventions. ENums are classes and should start with an upper-case letter (GeneralInformation
for example). An other source of confusion is the bad choice of names. JAVA is not a course list. It's a course. So the enum should be named Course
.