two questions about hard to understand java code
<p>I am reading java source code, encounter two little question, I don't know why sun write code like this, here are questions(jdk version:1.6):</p>

<p>Question 1:</p>

<pre><code>java.util.concurrent.PriorityBlockingQueue#offer(E e):


public boolean offer(E e) {
    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
        boolean ok = q.offer(e);
        assert ok;
        notEmpty.signal();
        return true;
    } finally {
        lock.unlock();
    }
}
</code></pre>

<p>why define a local final ReentrantLock variable in method block, why not directly use global variable 'lock'?</p>

<p>Question 2:</p>

<p><code>java.text.NumberFormat#getInstance(Locale desiredLocale, int choice):</code> this method create a <code>DecimalFormat</code> object but return type is <code>NumberFormat</code>. why not make return tye <code>DecimalFormat</code>?</p>

<p>thanks.</p>
