How to pass enum as an argument in a method in java?

后端 未结 6 1110
走了就别回头了
走了就别回头了 2021-01-03 18:47
public class Enumvalues{

    enum courseList {
        JAVA,
        C,
        PYTHON,
        PERL
    }

    enum generalInformation {
        NAME,
        AGE,         


        
6条回答
  •  鱼传尺愫
    2021-01-03 19:09

    An enum is used just like a type:

    static void printEnumValue(courseList generalInformation) { // how to receive enum  in this block
    

    used like:

    printEnumValue(courseList.JAVA);

提交回复
热议问题