title: In Java is there a performance difference between referencing a field through getter versus through a variable?
body: <p>Is there any differences between doing</p>
  
  <pre><code>Field field = something.getSomethingElse().getField();
  if (field == 0) {
  //do something    
  }
  somelist.add(field);
  </code></pre>
  
  <p>versus</p>
  
  <pre><code>if (something.getSomethingElse().getField() == 0) {
  //do something    
  }
  somelist.add(something.getSomethingElse().getField());
  </code></pre>
  
  <p><strong>Do references to the field through getters incur a performance penalty or is it the same as referencing an assigned variable?</strong> I understand that the variable is just a reference to the memory space, so the getter should just be another way to get at that memory space.</p>
  
  <p>Note that this is an academic question (school of just curious) rather then a practical one.</p>