单选题:Given code below:
Given code below:
```Java
public class Main {
int a = 10;
int c = 30;
public Runnable getRunnable() {
int a = 20;
return new Thread() {
public void run() {
int b = a+c;
}
};
}
}
```
What will be the value of b after the assignment in the run() method? @[C](2)
A. 30
B. 40
C. 50
D. Compile error
A.30
B.40
C.50
D.Compile error
答案:C
```Java
public class Main {
int a = 10;
int c = 30;
public Runnable getRunnable() {
int a = 20;
return new Thread() {
public void run() {
int b = a+c;
}
};
}
}
```
What will be the value of b after the assignment in the run() method? @[C](2)
A. 30
B. 40
C. 50
D. Compile error
A.30
B.40
C.50
D.Compile error
答案:C