[size=1em][size=1em]1
[size=1em]2
[size=1em]3
[size=1em]4
[size=1em]5
[size=1em]6
[size=1em]7
[size=1em]8
[size=1em]9
[size=1em]10
| [size=1em][size=1em]public class Test2 {
[size=1em]
[size=1em] public static int _i = 10;
[size=1em] static {
[size=1em] _i = 20;
[size=1em] }
[size=1em] public static void main(String[] args) {
[size=1em] System.out.println(_i);
[size=1em] }
[size=1em]}
|
输出结果 : 20 [size=1em][color=white !important][size=1em]?
[size=1em]1
[size=1em]2
[size=1em]3
[size=1em]4
[size=1em]5
[size=1em]6
[size=1em]7
[size=1em]8
[size=1em]9
[size=1em]10
[size=1em]11
| [size=1em][size=1em]public class Test2 {
[size=1em]
[size=1em] static {
[size=1em] _i = 20;
[size=1em] }
[size=1em] public static int _i = 10;
[size=1em] public static void main(String[] args) {
[size=1em] System.out.println(_i);
[size=1em] }
[size=1em]}
|
输出结果:10 这是为什么呢?
|