title: Java ArrayList syntax error outside of main class
body: <p>I'm trying to make a simple hangman game. The aspect I need help with is declaring the hangman stage, which is an arraylist. After moving this list outside of my main class, I received several syntax error warnings that were not reported before. </p>
  
  <p>I could move it back to the main class but that would mean a bit too much code in one place for my liking. I'd also like to get to the bottom of this.</p>
  
  <pre><code>public static void main(String[] args) {
  
  // omitted game setup code, ArrayList has been imported
  
  }
  
  public class hangMen{
  
      // here is where the error occurs
              // all of the lines below show a syntax error
              // All the lines have Syntax error on token ";" &amp; ".", @ expected
  
  
      List&lt;String&gt; stage = new ArrayList&lt;String&gt;();
      stage.add("-------");
      stage.add("|     |");
      stage.add("|");
      stage.add("|");
      stage.add("|");
      stage.add("|");
      stage.add("|___________");}
  </code></pre>
  
  <p>// The last line has Syntax error, insert ")" to complete method declaration, insert identifier to complete MethodHeaderName, insert "SimpleName" to complete qualified name</p>
  
  <p>I've never seen this come up before, and my teacher is confused too. Any help?</p>