/* * [BreedM.java] * * Summary: example use of enum with custom constructor. Enum for dog breed. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2006-03-02 */ package com.mindprod.example; /** * example use of enum with custom constructor. Enum for dog breed. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2006-03-02 * @since 2006-03-02 */ @SuppressWarnings( { "UnusedDeclaration", "WeakerAccess" } ) public enum BreedM { // the three enum constants /** * Dachshund smooth or curly */ DACHSHUND( "brown" ), /** * Dalmatian */ DALMATIAN( "spotted" ), /** * Labrador retrievers */ LABRADOR( "black or tan" ); // additional instance field of every BreedM enum constant object private final String colours; /** * constructor * * @param colours possible colours for this breed. */ BreedM( String colours ) { this.colours = colours; } /** * additional method of every BreedM enum constant object * * @return possible colours for this breed. */ public String getColours() { return colours; } }