I have the following enum class,
public enum Sample { READ, WRITE }
and in the next class I try to check the enum class,
public class SampleTest { public static void main(String[] args) { testEnumSample(Sample.READ); } public static void testEnumSample(Sample sample) { System.out.println(sample); } }
Here I specify Sample.READ , then passing it as a parameter to the testEnumSample method. Instead, if we want to instantiate an enum class and pass it as a parameter, what do we need to do?
java enums
Minus infinity
source share