Click here to watch in Youtube :
https://www.youtube.com/watch?v=vBpTqabVBtQ&list=UUhwKlOVR041tngjerWxVccw
Level.java
https://www.youtube.com/watch?v=vBpTqabVBtQ&list=UUhwKlOVR041tngjerWxVccw
Level.java
public enum Level
{
HIGH, MEDIUM, LOW
}
EnumDemo.java public class EnumDemo
{
public static void main(String[] args)
{
Level level = Level.MEDIUM;
/*
* We can use enums in switch statements like this.
*/
switch (level)
{
case HIGH:
System.out.println("This is high voltage");
break;
case MEDIUM:
System.out.println("This is medium voltage");
break;
case LOW:
System.out.println("This is low voltage");
break;
}
}
}
OutputThis is medium voltage
Click the below link to download the code:
No comments:
Post a Comment