title: Java local vs instance variable access speed
body: <p>So my question is about variable accessing speed in Java. Today in my "CS" (if you can call it that) the teacher presented a similar example to the following of a List:</p>
  
  <pre><code>public class ListExample&lt;T&gt; {
      private Node&lt;T&gt; head;
      private Node&lt;T&gt; tail;
  
      private class Node&lt;T&gt; { /* ... */ }
  
      public void append(T content) {
          if (!isEmpty()) {
              Node&lt;T&gt; dummy = new Node&lt;T&gt;(content);
              head = dummy;
              tail = dummy;
  
              head.setNext(head);
              // or this
              dummy.setNext(dummy);
  
          } else { /* ... */ }
      }
  
      // more methods
      // ...
  }
  </code></pre>
  
  <p>My question is: Would the call to <code>head.setNext(head)</code> be slower than <code>dummy.setNext(dummy)</code> ? Even if it's not noticeable.
  I was wondering this since <code>head</code> is obviously and instance var of the class and dummy is local, so would the local access be faster?</p>