次のコードがあるとします。
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);
}
}
シャドーイングの概念を教えてください。tooth
もう1つ、メインメソッドのコードで実際に使用されているものは何ですか?
そして、それが非常に醜いコードであることは知っていますが、SCJP の本の著者にとって醜いコードは標準的な選択です。