Monday 8 May 2017

Java Tutorial: Enum in java | Java enum [How to get all values of Java enum - Operation]

EnumDemo.java
enum Operation
{
    PLUS, MINUS, MULTIPLY, DIVIDE;

}

public class EnumDemo
{
    public static void main(String[] args)
    {
        
        Operation[] operationArray = Operation.values();
        
        /*
         * To loop a Enum object.
         */
        for (Operation operation : operationArray)
        {
            System.out.println(operation);
        }
    }
}
Output
PLUS
MINUS
MULTIPLY
DIVIDE
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/EnumDemo_Operation_all_Values_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/EnumDemo_Operation_all_Values_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/45d5519a1474198166ac515ccd559cc996bb550c/BasicJava/EnumDemo_Operation_all_Values_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment