Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: code tweaked to compile

...

Code Block
bgColor#FFcccc
enum HydroCarbonHydrocarbon {
  METHANE, ETHANE, PROPANE, BUTANE, PENTANE,
  HEXANE, HEPTANE, OCTANE, NONANE, DECANE;

  public int getNumberOfCarbons() {
    return ordinal() + 1;
  }
}

...

Code Block
bgColor#ccccff
enum HydroCarbonHydrocarbon {
  METHANE(1), ETHANE(2), PROPANE(3), BUTANE(4), PENTANE(5),
  HEXANE(6), HEPTANE(7), OCTANE(8), NONANE(9), DECANE(10);

  private final int numberOfCarbons;

  Hydrocarbon(int carbons) { this.numberOfCarbons = carbons; }

  public int getNumberOfCarbons() {
    return numberOfCarbons;
  }
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1732ebd43753b8aa-0809608d-449545c0-b941a449-ea19c24c6b5b802eb09f5294"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]

[§8.9, "Enums"

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7572c34eb231e651-75b37c63-42284a32-b867ba74-d9ef663e994a5a0d891d1fd0"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[Enum

http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html]

]]></ac:plain-text-body></ac:structured-macro>

...