Different behavior of overriding methods and fields
<p><br>
I just noticed that overriding methods does behave different than overriding fields.
Considering the following snippet:</p>

<pre><code>public class Bar {
  int v =1;

  public void printAll(){
    System.out.println(v);
    printV();
  }

  public void printV(){
    System.out.println("v is " + v);
  }
}

public class Foo extends Bar {
  int v = 4;

  public static void main(String[] args) {
    Foo foo = new Foo();
    foo.printAll();
 }

 public void printV() {
   System.out.println("The value v is  " + v);
 }
}
</code></pre>

<p>It result in the output:<br>
1<br>
The value v is  4</p>

<p>So it seems that the method printV in bar is overridden by foo.printV while the field v is not overwritten in bar. Does anyone know a reason for this difference?</p>

<p>Thanks.</p>
