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="1606cfc85f1b8195-feac61be-4db240d0-b7d3a8c5-37e96a552ee4915f711acdbc"><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="34ec7e1ae92cd7c0-b7f14eff-45c44c1a-99949cbd-1c9f404a2baca4a40dfe729d"><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>

...