Given the following code:
public class A {
static final long tooth = 1L;
static long tooth(long tooth){
System.out.println(++tooth);
return ++tooth;
}
public static void main(String args[]){
System.out.println(tooth);
final long tooth = 2L;
new A().tooth(tooth);
System.out.println(tooth);
}
}
Can you please explain me the concept of shadowing ?
And another thing, what tooth
is actually used in the code from the main method ?
And i know it's a very ugly code, but ugly is the standard choice for SCJP book writers.