title: Java: anonymous enums?
body: <p>Does Java have the possibility of anonymous enums?</p>
  
  <p>For example, I want my class to have one variable, whose value can be one of 5 different settings. So obviously that variable should be an enum. But this is the ONLY place where that particular enum will be used. Normally I would declare an enum type right above the variable and then declare the variable to be that type, but I was wondering if there is a cleaner way. Does Java support anonymous enums?</p>
  
  <p>Example:</p>
  
  <pre><code>public class Test {
      public enum Option {
          FirstOption,
          SecondOption,
          ThirdOption
      }
      Option option;
  }
  </code></pre>
  
  <p>Is there a way to avoid declaring <code>public enum Option</code> and instead simply allow the option variable to be set to either FirstOption, SecondOption or ThirdOption with no notion of the "Option" type?</p>