Friday, October 21, 2011

Declaring Constructors, Methods, and Variables in an enum

NOTE: the order of the line of the code is important for the following:

public enum SORT_ORDER
{
  ACCESSED_ASCENDING("accessed_ascending"),   
  ACCESSED_DESCENDING("accessed_descending");
   
  private SORT_ORDER(String p_value)
  {
   this.m_value = p_value;
  }

  private final String m_value;

  @Override
  public String toString()
  {
    return m_value;
  }
}

No comments:

Post a Comment