title: <identifier> expected error while creating object list
body: <p>Can someone help me resolve this innocuous Identifier expected error? I am declaring a Register class and trying to make a list of Register objects. </p>
  
  <p><strong>UPDATE</strong> : 'Register' is locally scoped in MySaxParser.java as Meesh suggested. But I still see identifier expected error. The complete code and error message is below: </p>
  
  <p>The issue was seen using java version "1.4.1_01" </p>
  
  <pre><code>import java.io.IOException;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.List;
  
  
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.parsers.SAXParser;
  import javax.xml.parsers.SAXParserFactory;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.DefaultHandler;
  
  
  
  public class MySaxParser extends DefaultHandler {
      List&lt;Register&gt; registerL;
      String xmlFileName;
      String tmpValue;
      Register registerTmp;
  
      public MySaxParser(String xmlFileName) {
          this.xmlFileName = xmlFileName;
          registerL = new ArrayList&lt;Register&gt;();
          parseDocument();
          printDatas();
      }
      private void parseDocument() {
          // parse
          SAXParserFactory factory = SAXParserFactory.newInstance();
          try {
              SAXParser parser = factory.newSAXParser();
              parser.parse(xmlFileName, this);
          } catch (ParserConfigurationException e) {
              System.out.println("ParserConfig error");
          } catch (SAXException e) {
              System.out.println("SAXException : xml not well formed");
          } catch (IOException e) {
              System.out.println("IO error");
          }
      }
      private void printDatas() {
         // System.out.println(bookL.size());
          for (Register tmpReg : registerL) {
              System.out.println(tmpReg.toString());
          }
      }
      @Override
      public void startElement(String s, String s1, String elementName, Attributes attributes) throws SAXException {
          // if current element is book , create new book
          // clear tmpValue on start of element
  
          if (elementName.equalsIgnoreCase("reg")) {
              registerTmp = new Register();
              registerTmp.setregName(attributes.getValue("regname"));
              registerTmp.setaddr(attributes.getValue("addr"));
          }
      }
  
      @Override
      public void characters(char[] ac, int i, int j) throws SAXException {
          tmpValue = new String(ac, i, j);
      }
      public static void main(String[] args) {
          new MySaxParser("register.xml");
      }
  }
  
  
  
  /*****
   * Model class for Regsiter
   * ****/
   class Register { 
     String regName;
     String addr;
  
     //Setters 
     public void setregName(String regName ) {     this.regName = regName; } 
     public void setaddr (String addr ) {     this.addr = addr; } 
  
     //Getters
      public String getregName() {    return this.regName; } 
      public String getaddr() { return this.addr;}
  
  }
  </code></pre>
  
  <p><strong>ERROR:</strong>  </p>
  
  <pre><code>MySaxParser.java:19: &lt;identifier&gt; expected
      List&lt;Register&gt; registerL;
          ^
  MySaxParser.java:26: '(' or '[' expected
          registerL = new ArrayList&lt;Register&gt;();
                                   ^
  MySaxParser.java:46: ';' expected
          for (Register tmpReg : registerL) {
                               ^
  MySaxParser.java:49: illegal start of expression
      }
      ^
  MySaxParser.java:48: ';' expected
          }
           ^
  MySaxParser.java:50: illegal character: \64
      @Override
      ^
  MySaxParser.java:62: illegal character: \64
      @Override
      ^
  MySaxParser.java:68: &lt;identifier&gt; expected
      }
       ^
  MySaxParser.java:26: cannot resolve symbol
  symbol  : variable registerL 
  location: class MySaxParser
          registerL = new ArrayList&lt;Register&gt;();
          ^
  9 errors
  </code></pre>