title: @XmlElement and @XmlAccessorType(XmlAccessType.FIELD)
body: <p>I have a strange behaviour, and I don't understand it.</p>
  
  <pre><code>@XmlRootElement
  public class Object {
  @XmlElement(name = "object")
  private List&lt;Object&gt; objectList = new ArrayList&lt;Object&gt;();
  
      public List&lt;Object&gt; getObjectList() {
          return objectList;
      }
  }
  </code></pre>
  
  <p>This part should hold values for each object.</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  public class Object {
      @XmlElement
      private int id;
      private int value;
  }
  </code></pre>
  
  <p>I don't understand why are there values passed into the <code>id</code> and <code>value</code> fields. Is it necessary to write <code>@XmlElement</code> if the names are the same?</p>