I'm reading my Deitel, Java How to Program book and came across the term shadowing. If shadowing is allowed, what situation or what purpose is there for it in a Java class?
Example:
public class Foo {
int x = 5;
public void useField() {
System.out.println(this.x);
}
public void useLocal() {
int x = 10;
System.out.println(x);
}
}