Hello I was using the santis self tester and was confused by the following problem:
// ...some code...
private void somethingLikeAMethod() {
double a =10;
String d="Weapon";
final String c = "Loaded";
final double b = 10;
class Class{
void method() {
System.out.println(Math.sin(a));
System.out.println(c+" "+d);
System.out.println(Math.rint(b));
}
}
}
// .. Some code...
The question is: Which variables can the inner class read (There are 2)?
I thought a and d, because they are final, but the answer is B,C and the reason given is: The scope of the variables a and d are to low. Can anyone provide a better explanation about why b and c are not in scope?
Thanks in advance.