Answers for "printing out enums java"

0

printing out enums java

/**
 * A Java enum toString example.
 * @author alvin alexander, alvinalexander.com
 */
public class JavaEnumToStringExample
{

  public static void main(String[] args)
  {
    // loop through the enum values, calling the
    // enum toString method for each enum constant
    for (Day d: Day.values())
    {
      System.out.println(d);
    }
  }
}

enum Day
{
  SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY 
}
Posted by: Guest on November-16-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language