How JAVA loops enumerations (in the main function)

Source: Internet
Author: User

/** * bestpay.com.cn inc. * copyright  (c)  2011-2015 all rights  Reserved. */package com.bestpay.bpbp.common.enums;/** *  Offs Business Type enumeration  *  *   @author  Weiliang *  @version   $Id: biztypeenum.java, v 0.1  December 14, 2015   PM 2:20:53 weiliang exp $ */public enum biztypeenum {     train_ticket ("Train_ticket",  "Train Ticket"),     transport_deposit (" Transport_deposit ", " Traffic card Recharge ");    /**  enumeration code   */     private string code;    /**  Description Description  */    private  String description;    /**     *  Default constructors       *      *  @param  code  Enumeration encoding        *  @param  d escription  description      *  @param  isfinish     * /    private biztypeenum (string code, string description)  {         this.code = code;         this.description = description;    }    /**      *  enumerating through enumerations <code>code</code> getting enumerations      *       *  @param  code  Enumeration encoding       *   @return   Payment order Status Enumeration      */    public static  Biztypeenum getbycode (String code)  {        for  ( Biztypeenum biztypeenum : values ())  {             if  (BiztypEenum.getcode (). Equals (code))  {                 return bizTypeEnum;             }        }         return null;    }    /**     *  getter method for property <tt>code</tt>.     *       *  @return  property value of code      */    public string getcode ()  {         return code;    }    /**      * Getter method for property <tt>description</tt>.      *      *  @return  property value of description      */    public string getdescription ()  {         return description;    }    public  Static void main (String[] args)  {         Biztypeenum [] customerrorcodeenums=biztypeenum.values ();         for (int i=0;i<customerrorcodeenums.length;i++) {             system.out.println (Customerrorcodeenums[i].getcode ());             system.out.println (Customerrorcodeenums[i].getdescription ());         }    }}


How JAVA loops enumerations (in the main function)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.